
<!DOCTYPE html><html lang="zh-CN"><head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>fs | Node.js API &#x6587;&#x6863;</title>
    <link rel="icon" sizes="32x32" type="image/png" href="//static.nodejs.cn/_static/img/favicon.png">
    <script>
      document.write('<link href="' + (location.port?'':'//static.nodejs.cn') + '/_static/css/api.css?1597399169734" rel="stylesheet">')
    </script>
    
  </head>
  <body class="alt apidoc" id="page_api">
    <div id="api-section-fs">
      <div id="content" class="clearfix">
        <div id="column2" class="interior">
          <div id="intro" class="interior">
            <a href="/" rel="nofollow">
              Node.js &#x4E2D;&#x6587;&#x7F51;
            </a>
            
          </div>
          <!-- <ul>
            <li><a href="./" class="nav-documentation">v14.8.0</a></li>
          </ul> -->
          <div id="biz_nav"><a title="&#x5F00;&#x8BFE;&#x5427;" target="_blank" href="https://datayi.cn/w/a9a7AGZP" rel="nofollow"><img></a></div>
          <div class="line"></div>
          <ul>
  <li><a href="assert.html" class="nav-assert" rel="nofollow">assert - &#x65AD;&#x8A00;</a></li>
  <li><a href="async_hooks.html" class="nav-async_hooks" rel="nofollow">async_hooks - &#x5F02;&#x6B65;&#x94A9;&#x5B50;</a></li>
  <li><a href="buffer.html" class="nav-buffer" rel="nofollow">Buffer - &#x7F13;&#x51B2;&#x5668;</a></li>
  <li><a href="child_process.html" class="nav-child_process" rel="nofollow">child_process - &#x5B50;&#x8FDB;&#x7A0B;</a></li>
  <li><a href="cluster.html" class="nav-cluster" rel="nofollow">cluster - &#x96C6;&#x7FA4;</a></li>
  <li><a href="console.html" class="nav-console" rel="nofollow">console - &#x63A7;&#x5236;&#x53F0;</a></li>
  <li><a href="crypto.html" class="nav-crypto" rel="nofollow">crypto - &#x52A0;&#x5BC6;</a></li>
  <li><a href="debugger.html" class="nav-debugger" rel="nofollow">debugger - &#x8C03;&#x8BD5;&#x5668;</a></li>
  <li><a href="dgram.html" class="nav-dgram" rel="nofollow">dgram - &#x6570;&#x636E;&#x62A5;</a></li>
  <li><a href="dns.html" class="nav-dns" rel="nofollow">dns - &#x57DF;&#x540D;&#x670D;&#x52A1;&#x5668;</a></li>
  <li><a href="domain.html" class="nav-domain" rel="nofollow">domain - &#x57DF;</a></li>
  <li><a href="errors.html" class="nav-errors" rel="nofollow">Error - &#x9519;&#x8BEF;</a></li>
  <li><a href="events.html" class="nav-events" rel="nofollow">events - &#x4E8B;&#x4EF6;&#x89E6;&#x53D1;&#x5668;</a></li>
  <li><a href="fs.html" class="nav-fs active" rel="nofollow">fs - &#x6587;&#x4EF6;&#x7CFB;&#x7EDF;</a></li>
  <li><a href="globals.html" class="nav-globals" rel="nofollow">global - &#x5168;&#x5C40;&#x53D8;&#x91CF;</a></li>
  <li><a href="http.html" class="nav-http" rel="nofollow">http - HTTP</a></li>
  <li><a href="http2.html" class="nav-http2" rel="nofollow">http2 - HTTP/2</a></li>
  <li><a href="https.html" class="nav-https" rel="nofollow">https - HTTPS</a></li>
  <li><a href="inspector.html" class="nav-inspector" rel="nofollow">inspector - &#x68C0;&#x67E5;&#x5668;</a></li>
  <li><a href="modules.html" class="nav-modules" rel="nofollow">module - &#x6A21;&#x5757;</a></li>
  <li><a href="net.html" class="nav-net" rel="nofollow">net - &#x7F51;&#x7EDC;</a></li>
  <li><a href="os.html" class="nav-os" rel="nofollow">os - &#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;</a></li>
  <li><a href="path.html" class="nav-path" rel="nofollow">path - &#x8DEF;&#x5F84;</a></li>
  <li><a href="perf_hooks.html" class="nav-perf_hooks" rel="nofollow">perf_hooks - &#x6027;&#x80FD;&#x94A9;&#x5B50;</a></li>
  <li><a href="process.html" class="nav-process" rel="nofollow">process - &#x8FDB;&#x7A0B;</a></li>
  <li><a href="punycode.html" class="nav-punycode" rel="nofollow">punycode - &#x57DF;&#x540D;&#x4EE3;&#x7801;</a></li>
  <li><a href="querystring.html" class="nav-querystring" rel="nofollow">querystring - &#x67E5;&#x8BE2;&#x5B57;&#x7B26;&#x4E32;</a></li>
  <li><a href="readline.html" class="nav-readline" rel="nofollow">readline - &#x9010;&#x884C;&#x8BFB;&#x53D6;</a></li>
  <li><a href="repl.html" class="nav-repl" rel="nofollow">repl - &#x4EA4;&#x4E92;&#x5F0F;&#x89E3;&#x91CA;&#x5668;</a></li>
  <li><a href="stream.html" class="nav-stream" rel="nofollow">stream - &#x6D41;</a></li>
  <li><a href="string_decoder.html" class="nav-string_decoder" rel="nofollow">string_decoder - &#x5B57;&#x7B26;&#x4E32;&#x89E3;&#x7801;&#x5668;</a></li>
  <li><a href="timers.html" class="nav-timers" rel="nofollow">timer - &#x5B9A;&#x65F6;&#x5668;</a></li>
  <li><a href="tls.html" class="nav-tls" rel="nofollow">tls - &#x5B89;&#x5168;&#x4F20;&#x8F93;&#x5C42;</a></li>
  <li><a href="tracing.html" class="nav-tracing" rel="nofollow">trace_events - &#x8DDF;&#x8E2A;&#x4E8B;&#x4EF6;</a></li>
  <li><a href="tty.html" class="nav-tty" rel="nofollow">tty - &#x7EC8;&#x7AEF;</a></li>
  <li><a href="url.html" class="nav-url" rel="nofollow">url - URL</a></li>
  <li><a href="util.html" class="nav-util" rel="nofollow">util - &#x5B9E;&#x7528;&#x5DE5;&#x5177;</a></li>
  <li><a href="v8.html" class="nav-v8" rel="nofollow">v8 - V8&#x5F15;&#x64CE;</a></li>
  <li><a href="vm.html" class="nav-vm" rel="nofollow">vm - &#x865A;&#x62DF;&#x673A;</a></li>
  <li><a href="wasi.html" class="nav-wasi" rel="nofollow">wasi - WASI</a></li>
  <li><a href="worker_threads.html" class="nav-worker_threads" rel="nofollow">worker_threads - &#x5DE5;&#x4F5C;&#x7EBF;&#x7A0B;</a></li>
  <li><a href="zlib.html" class="nav-zlib" rel="nofollow">zlib - &#x538B;&#x7F29;</a></li>
  </ul>
  <div class="line"></div>
  <ul>
  <li><a href="documentation.html" class="nav-documentation" rel="nofollow">&#x5173;&#x4E8E;&#x672C;&#x6587;&#x6863;</a></li>
  <li><a href="synopsis.html" class="nav-synopsis" rel="nofollow">&#x7528;&#x6CD5;&#x4E0E;&#x793A;&#x4F8B;</a></li>
  <li><a href="addons.html" class="nav-addons" rel="nofollow">C++ &#x63D2;&#x4EF6;</a></li>
  <li><a href="embedding.html" class="nav-embedding" rel="nofollow">C++ &#x5D4C;&#x5165;&#x5668;</a></li>
  <li><a href="n-api.html" class="nav-n-api" rel="nofollow">N-API</a></li>
  <li><a href="cli.html" class="nav-cli" rel="nofollow">&#x547D;&#x4EE4;&#x884C;&#x9009;&#x9879;</a></li>
  <li><a href="esm.html" class="nav-esm" rel="nofollow">ECMAScript &#x6A21;&#x5757;</a></li>
  <li><a href="policy.html" class="nav-policy" rel="nofollow">&#x5B89;&#x5168;&#x7B56;&#x7565;</a></li>
  <li><a href="report.html" class="nav-report" rel="nofollow">&#x8BCA;&#x65AD;&#x62A5;&#x8868;</a></li>
  <li><a href="intl.html" class="nav-intl" rel="nofollow">&#x56FD;&#x9645;&#x5316;&#x652F;&#x6301;</a></li>
  <li><a href="deprecations.html" class="nav-deprecations" rel="nofollow">&#x5F03;&#x7528;&#x7684; API</a></li>
  </ul>
          
        </div>
    
        <div id="column1" data-id="fs" class="interior">
          <header>
            <h1>Node.js v14.8.0 &#x6587;&#x6863;</h1>
            <div id="gtoc">
              <ul>
                <li>
                  <a href="./" name="toc">&#x8FD4;&#x56DE;&#x6587;&#x6863;&#x9996;&#x9875;</a>
                </li>
                <li>
                  <a href="/search" name="toc">&#x641C;&#x7D22;</a>
                </li>
                <!--  -->
              </ul>
            </div>
            <hr>
          </header>
  
          
          
          <div id="toc">
            <h2>&#x76EE;&#x5F55;</h2>
            <ul>
  <li>
  <p><span class="stability_2"><a href="#fs_file_system">fs&#xFF08;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#xFF09;</a></span></p>
  <ul>
  <li>
  <p><a href="#fs_file_paths">&#x6587;&#x4EF6;&#x8DEF;&#x5F84;</a></p>
  <ul>
  <li><a href="#fs_url_object_support">URL &#x5BF9;&#x8C61;&#x7684;&#x652F;&#x6301;</a></li>
  </ul>
  </li>
  <li><a href="#fs_file_descriptors">&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;</a></li>
  <li><a href="#fs_threadpool_usage">&#x7EBF;&#x7A0B;&#x6C60;&#x7684;&#x4F7F;&#x7528;</a></li>
  <li>
  <p><a href="#fs_class_fs_dir">fs.Dir &#x7C7B;</a></p>
  <ul>
  <li><a href="#fs_dir_close"><code>dir.close()</code></a></li>
  <li><a href="#fs_dir_close_callback"><code>dir.close(callback)</code></a></li>
  <li><a href="#fs_dir_closesync"><code>dir.closeSync()</code></a></li>
  <li><a href="#fs_dir_path"><code>dir.path</code></a></li>
  <li><a href="#fs_dir_read"><code>dir.read()</code></a></li>
  <li><a href="#fs_dir_read_callback"><code>dir.read(callback)</code></a></li>
  <li><a href="#fs_dir_readsync"><code>dir.readSync()</code></a></li>
  <li><a href="#fs_dir_symbol_asynciterator"><code>dir[Symbol.asyncIterator]()</code></a></li>
  </ul>
  </li>
  <li>
  <p><a href="#fs_class_fs_dirent">fs.Dirent &#x7C7B;</a></p>
  <ul>
  <li><a href="#fs_dirent_isblockdevice"><code>dirent.isBlockDevice()</code></a></li>
  <li><a href="#fs_dirent_ischaracterdevice"><code>dirent.isCharacterDevice()</code></a></li>
  <li><a href="#fs_dirent_isdirectory"><code>dirent.isDirectory()</code></a></li>
  <li><a href="#fs_dirent_isfifo"><code>dirent.isFIFO()</code></a></li>
  <li><a href="#fs_dirent_isfile"><code>dirent.isFile()</code></a></li>
  <li><a href="#fs_dirent_issocket"><code>dirent.isSocket()</code></a></li>
  <li><a href="#fs_dirent_issymboliclink"><code>dirent.isSymbolicLink()</code></a></li>
  <li><a href="#fs_dirent_name"><code>dirent.name</code></a></li>
  </ul>
  </li>
  <li>
  <p><a href="#fs_class_fs_fswatcher">fs.FSWatcher &#x7C7B;</a></p>
  <ul>
  <li><a href="#fs_event_change">&apos;change&apos; &#x4E8B;&#x4EF6;</a></li>
  <li><a href="#fs_event_close">&apos;close&apos; &#x4E8B;&#x4EF6;</a></li>
  <li><a href="#fs_event_error">&apos;error&apos; &#x4E8B;&#x4EF6;</a></li>
  <li><a href="#fs_watcher_close"><code>watcher.close()</code></a></li>
  <li><a href="#fs_watcher_ref"><code>watcher.ref()</code></a></li>
  <li><a href="#fs_watcher_unref"><code>watcher.unref()</code></a></li>
  </ul>
  </li>
  <li>
  <p><a href="#fs_class_fs_statwatcher">fs.StatWatcher &#x7C7B;</a></p>
  <ul>
  <li><a href="#fs_watcher_ref_1"><code>watcher.ref()</code></a></li>
  <li><a href="#fs_watcher_unref_1"><code>watcher.unref()</code></a></li>
  </ul>
  </li>
  <li>
  <p><a href="#fs_class_fs_readstream">fs.ReadStream &#x7C7B;</a></p>
  <ul>
  <li><a href="#fs_event_close_1">&apos;close&apos; &#x4E8B;&#x4EF6;</a></li>
  <li><a href="#fs_event_open">&apos;open&apos; &#x4E8B;&#x4EF6;</a></li>
  <li><a href="#fs_event_ready">&apos;ready&apos; &#x4E8B;&#x4EF6;</a></li>
  <li><a href="#fs_readstream_bytesread"><code>readStream.bytesRead</code></a></li>
  <li><a href="#fs_readstream_path"><code>readStream.path</code></a></li>
  <li><a href="#fs_readstream_pending"><code>readStream.pending</code></a></li>
  </ul>
  </li>
  <li>
  <p><a href="#fs_class_fs_stats">fs.Stats &#x7C7B;</a></p>
  <ul>
  <li><a href="#fs_stats_isblockdevice"><code>stats.isBlockDevice()</code></a></li>
  <li><a href="#fs_stats_ischaracterdevice"><code>stats.isCharacterDevice()</code></a></li>
  <li><a href="#fs_stats_isdirectory"><code>stats.isDirectory()</code></a></li>
  <li><a href="#fs_stats_isfifo"><code>stats.isFIFO()</code></a></li>
  <li><a href="#fs_stats_isfile"><code>stats.isFile()</code></a></li>
  <li><a href="#fs_stats_issocket"><code>stats.isSocket()</code></a></li>
  <li><a href="#fs_stats_issymboliclink"><code>stats.isSymbolicLink()</code></a></li>
  <li><a href="#fs_stats_dev"><code>stats.dev</code></a></li>
  <li><a href="#fs_stats_ino"><code>stats.ino</code></a></li>
  <li><a href="#fs_stats_mode"><code>stats.mode</code></a></li>
  <li><a href="#fs_stats_nlink"><code>stats.nlink</code></a></li>
  <li><a href="#fs_stats_uid"><code>stats.uid</code></a></li>
  <li><a href="#fs_stats_gid"><code>stats.gid</code></a></li>
  <li><a href="#fs_stats_rdev"><code>stats.rdev</code></a></li>
  <li><a href="#fs_stats_size"><code>stats.size</code></a></li>
  <li><a href="#fs_stats_blksize"><code>stats.blksize</code></a></li>
  <li><a href="#fs_stats_blocks"><code>stats.blocks</code></a></li>
  <li><a href="#fs_stats_atimems"><code>stats.atimeMs</code></a></li>
  <li><a href="#fs_stats_mtimems"><code>stats.mtimeMs</code></a></li>
  <li><a href="#fs_stats_ctimems"><code>stats.ctimeMs</code></a></li>
  <li><a href="#fs_stats_birthtimems"><code>stats.birthtimeMs</code></a></li>
  <li><a href="#fs_stats_atimens"><code>stats.atimeNs</code></a></li>
  <li><a href="#fs_stats_mtimens"><code>stats.mtimeNs</code></a></li>
  <li><a href="#fs_stats_ctimens"><code>stats.ctimeNs</code></a></li>
  <li><a href="#fs_stats_birthtimens"><code>stats.birthtimeNs</code></a></li>
  <li><a href="#fs_stats_atime"><code>stats.atime</code></a></li>
  <li><a href="#fs_stats_mtime"><code>stats.mtime</code></a></li>
  <li><a href="#fs_stats_ctime"><code>stats.ctime</code></a></li>
  <li><a href="#fs_stats_birthtime"><code>stats.birthtime</code></a></li>
  <li><a href="#fs_stat_time_values">&#x6587;&#x4EF6;&#x5C5E;&#x6027;&#x7684;&#x65F6;&#x95F4;&#x503C;</a></li>
  </ul>
  </li>
  <li>
  <p><a href="#fs_class_fs_writestream">fs.WriteStream &#x7C7B;</a></p>
  <ul>
  <li><a href="#fs_event_close_2">&apos;close&apos; &#x4E8B;&#x4EF6;</a></li>
  <li><a href="#fs_event_open_1">&apos;open&apos; &#x4E8B;&#x4EF6;</a></li>
  <li><a href="#fs_event_ready_1">&apos;ready&apos; &#x4E8B;&#x4EF6;</a></li>
  <li><a href="#fs_writestream_byteswritten"><code>writeStream.bytesWritten</code></a></li>
  <li><a href="#fs_writestream_path"><code>writeStream.path</code></a></li>
  <li><a href="#fs_writestream_pending"><code>writeStream.pending</code></a></li>
  </ul>
  </li>
  <li><a href="#fs_fs_access_path_mode_callback"><code>fs.access(path[, mode], callback)</code></a></li>
  <li><a href="#fs_fs_accesssync_path_mode"><code>fs.accessSync(path[, mode])</code></a></li>
  <li><a href="#fs_fs_appendfile_path_data_options_callback"><code>fs.appendFile(path, data[, options], callback)</code></a></li>
  <li><a href="#fs_fs_appendfilesync_path_data_options"><code>fs.appendFileSync(path, data[, options])</code></a></li>
  <li>
  <p><a href="#fs_fs_chmod_path_mode_callback"><code>fs.chmod(path, mode, callback)</code></a></p>
  <ul>
  <li><a href="#fs_file_modes">&#x6587;&#x4EF6;&#x7684;&#x6A21;&#x5F0F;</a></li>
  </ul>
  </li>
  <li><a href="#fs_fs_chmodsync_path_mode"><code>fs.chmodSync(path, mode)</code></a></li>
  <li><a href="#fs_fs_chown_path_uid_gid_callback"><code>fs.chown(path, uid, gid, callback)</code></a></li>
  <li><a href="#fs_fs_chownsync_path_uid_gid"><code>fs.chownSync(path, uid, gid)</code></a></li>
  <li><a href="#fs_fs_close_fd_callback"><code>fs.close(fd, callback)</code></a></li>
  <li><a href="#fs_fs_closesync_fd"><code>fs.closeSync(fd)</code></a></li>
  <li><a href="#fs_fs_constants"><code>fs.constants</code></a></li>
  <li><a href="#fs_fs_copyfile_src_dest_mode_callback"><code>fs.copyFile(src, dest[, mode], callback)</code></a></li>
  <li><a href="#fs_fs_copyfilesync_src_dest_mode"><code>fs.copyFileSync(src, dest[, mode])</code></a></li>
  <li><a href="#fs_fs_createreadstream_path_options"><code>fs.createReadStream(path[, options])</code></a></li>
  <li><a href="#fs_fs_createwritestream_path_options"><code>fs.createWriteStream(path[, options])</code></a></li>
  <li><span class="stability_0"><a href="#fs_fs_exists_path_callback"><code>fs.exists(path, callback)</code></a></span></li>
  <li><a href="#fs_fs_existssync_path"><code>fs.existsSync(path)</code></a></li>
  <li><a href="#fs_fs_fchmod_fd_mode_callback"><code>fs.fchmod(fd, mode, callback)</code></a></li>
  <li><a href="#fs_fs_fchmodsync_fd_mode"><code>fs.fchmodSync(fd, mode)</code></a></li>
  <li><a href="#fs_fs_fchown_fd_uid_gid_callback"><code>fs.fchown(fd, uid, gid, callback)</code></a></li>
  <li><a href="#fs_fs_fchownsync_fd_uid_gid"><code>fs.fchownSync(fd, uid, gid)</code></a></li>
  <li><a href="#fs_fs_fdatasync_fd_callback"><code>fs.fdatasync(fd, callback)</code></a></li>
  <li><a href="#fs_fs_fdatasyncsync_fd"><code>fs.fdatasyncSync(fd)</code></a></li>
  <li><a href="#fs_fs_fstat_fd_options_callback"><code>fs.fstat(fd[, options], callback)</code></a></li>
  <li><a href="#fs_fs_fstatsync_fd_options"><code>fs.fstatSync(fd[, options])</code></a></li>
  <li><a href="#fs_fs_fsync_fd_callback"><code>fs.fsync(fd, callback)</code></a></li>
  <li><a href="#fs_fs_fsyncsync_fd"><code>fs.fsyncSync(fd)</code></a></li>
  <li><a href="#fs_fs_ftruncate_fd_len_callback"><code>fs.ftruncate(fd[, len], callback)</code></a></li>
  <li><a href="#fs_fs_ftruncatesync_fd_len"><code>fs.ftruncateSync(fd[, len])</code></a></li>
  <li><a href="#fs_fs_futimes_fd_atime_mtime_callback"><code>fs.futimes(fd, atime, mtime, callback)</code></a></li>
  <li><a href="#fs_fs_futimessync_fd_atime_mtime"><code>fs.futimesSync(fd, atime, mtime)</code></a></li>
  <li><a href="#fs_fs_lchmod_path_mode_callback"><code>fs.lchmod(path, mode, callback)</code></a></li>
  <li><a href="#fs_fs_lchmodsync_path_mode"><code>fs.lchmodSync(path, mode)</code></a></li>
  <li><a href="#fs_fs_lchown_path_uid_gid_callback"><code>fs.lchown(path, uid, gid, callback)</code></a></li>
  <li><a href="#fs_fs_lchownsync_path_uid_gid"><code>fs.lchownSync(path, uid, gid)</code></a></li>
  <li><a href="#fs_fs_lutimes_path_atime_mtime_callback"><code>fs.lutimes(path, atime, mtime, callback)</code></a></li>
  <li><a href="#fs_fs_lutimessync_path_atime_mtime"><code>fs.lutimesSync(path, atime, mtime)</code></a></li>
  <li><a href="#fs_fs_link_existingpath_newpath_callback"><code>fs.link(existingPath, newPath, callback)</code></a></li>
  <li><a href="#fs_fs_linksync_existingpath_newpath"><code>fs.linkSync(existingPath, newPath)</code></a></li>
  <li><a href="#fs_fs_lstat_path_options_callback"><code>fs.lstat(path[, options], callback)</code></a></li>
  <li><a href="#fs_fs_lstatsync_path_options"><code>fs.lstatSync(path[, options])</code></a></li>
  <li><a href="#fs_fs_mkdir_path_options_callback"><code>fs.mkdir(path[, options], callback)</code></a></li>
  <li><a href="#fs_fs_mkdirsync_path_options"><code>fs.mkdirSync(path[, options])</code></a></li>
  <li><a href="#fs_fs_mkdtemp_prefix_options_callback"><code>fs.mkdtemp(prefix[, options], callback)</code></a></li>
  <li><a href="#fs_fs_mkdtempsync_prefix_options"><code>fs.mkdtempSync(prefix[, options])</code></a></li>
  <li><a href="#fs_fs_open_path_flags_mode_callback"><code>fs.open(path[, flags[, mode]], callback)</code></a></li>
  <li><a href="#fs_fs_opendir_path_options_callback"><code>fs.opendir(path[, options], callback)</code></a></li>
  <li><a href="#fs_fs_opendirsync_path_options"><code>fs.opendirSync(path[, options])</code></a></li>
  <li><a href="#fs_fs_opensync_path_flags_mode"><code>fs.openSync(path[, flags, mode])</code></a></li>
  <li><a href="#fs_fs_read_fd_buffer_offset_length_position_callback"><code>fs.read(fd, buffer, offset, length, position, callback)</code></a></li>
  <li><a href="#fs_fs_read_fd_options_callback"><code>fs.read(fd, [options,] callback)</code></a></li>
  <li><a href="#fs_fs_readdir_path_options_callback"><code>fs.readdir(path[, options], callback)</code></a></li>
  <li><a href="#fs_fs_readdirsync_path_options"><code>fs.readdirSync(path[, options])</code></a></li>
  <li>
  <p><a href="#fs_fs_readfile_path_options_callback"><code>fs.readFile(path[, options], callback)</code></a></p>
  <ul>
  <li><a href="#fs_file_descriptors_1">&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;</a></li>
  </ul>
  </li>
  <li><a href="#fs_fs_readfilesync_path_options"><code>fs.readFileSync(path[, options])</code></a></li>
  <li><a href="#fs_fs_readlink_path_options_callback"><code>fs.readlink(path[, options], callback)</code></a></li>
  <li><a href="#fs_fs_readlinksync_path_options"><code>fs.readlinkSync(path[, options])</code></a></li>
  <li><a href="#fs_fs_readsync_fd_buffer_offset_length_position"><code>fs.readSync(fd, buffer, offset, length, position)</code></a></li>
  <li><a href="#fs_fs_readsync_fd_buffer_options"><code>fs.readSync(fd, buffer, [options])</code></a></li>
  <li><a href="#fs_fs_readv_fd_buffers_position_callback"><code>fs.readv(fd, buffers[, position], callback)</code></a></li>
  <li><a href="#fs_fs_readvsync_fd_buffers_position"><code>fs.readvSync(fd, buffers[, position])</code></a></li>
  <li><a href="#fs_fs_realpath_path_options_callback"><code>fs.realpath(path[, options], callback)</code></a></li>
  <li><a href="#fs_fs_realpath_native_path_options_callback"><code>fs.realpath.native(path[, options], callback)</code></a></li>
  <li><a href="#fs_fs_realpathsync_path_options"><code>fs.realpathSync(path[, options])</code></a></li>
  <li><a href="#fs_fs_realpathsync_native_path_options"><code>fs.realpathSync.native(path[, options])</code></a></li>
  <li><a href="#fs_fs_rename_oldpath_newpath_callback"><code>fs.rename(oldPath, newPath, callback)</code></a></li>
  <li><a href="#fs_fs_renamesync_oldpath_newpath"><code>fs.renameSync(oldPath, newPath)</code></a></li>
  <li><span class="stability_1"><a href="#fs_fs_rmdir_path_options_callback"><code>fs.rmdir(path[, options], callback)</code></a></span></li>
  <li><span class="stability_1"><a href="#fs_fs_rmdirsync_path_options"><code>fs.rmdirSync(path[, options])</code></a></span></li>
  <li><a href="#fs_fs_stat_path_options_callback"><code>fs.stat(path[, options], callback)</code></a></li>
  <li><a href="#fs_fs_statsync_path_options"><code>fs.statSync(path[, options])</code></a></li>
  <li><a href="#fs_fs_symlink_target_path_type_callback"><code>fs.symlink(target, path[, type], callback)</code></a></li>
  <li><a href="#fs_fs_symlinksync_target_path_type"><code>fs.symlinkSync(target, path[, type])</code></a></li>
  <li><a href="#fs_fs_truncate_path_len_callback"><code>fs.truncate(path[, len], callback)</code></a></li>
  <li><a href="#fs_fs_truncatesync_path_len"><code>fs.truncateSync(path[, len])</code></a></li>
  <li><a href="#fs_fs_unlink_path_callback"><code>fs.unlink(path, callback)</code></a></li>
  <li><a href="#fs_fs_unlinksync_path"><code>fs.unlinkSync(path)</code></a></li>
  <li><a href="#fs_fs_unwatchfile_filename_listener"><code>fs.unwatchFile(filename[, listener])</code></a></li>
  <li><a href="#fs_fs_utimes_path_atime_mtime_callback"><code>fs.utimes(path, atime, mtime, callback)</code></a></li>
  <li><a href="#fs_fs_utimessync_path_atime_mtime"><code>fs.utimesSync(path, atime, mtime)</code></a></li>
  <li>
  <p><a href="#fs_fs_watch_filename_options_listener"><code>fs.watch(filename[, options][, listener])</code></a></p>
  <ul>
  <li>
  <p><a href="#fs_caveats">&#x6CE8;&#x610F;&#x4E8B;&#x9879;</a></p>
  <ul>
  <li><a href="#fs_availability">&#x53EF;&#x7528;&#x6027;</a></li>
  <li><a href="#fs_inodes">&#x7D22;&#x5F15;&#x8282;&#x70B9;</a></li>
  <li><a href="#fs_filename_argument">&#x6587;&#x4EF6;&#x540D;&#x53C2;&#x6570;</a></li>
  </ul>
  </li>
  </ul>
  </li>
  <li><a href="#fs_fs_watchfile_filename_options_listener"><code>fs.watchFile(filename[, options], listener)</code></a></li>
  <li><a href="#fs_fs_write_fd_buffer_offset_length_position_callback"><code>fs.write(fd, buffer[, offset[, length[, position]]], callback)</code></a></li>
  <li><a href="#fs_fs_write_fd_string_position_encoding_callback"><code>fs.write(fd, string[, position[, encoding]], callback)</code></a></li>
  <li>
  <p><a href="#fs_fs_writefile_file_data_options_callback"><code>fs.writeFile(file, data[, options], callback)</code></a></p>
  <ul>
  <li><a href="#fs_using_fs_writefile_with_file_descriptors">&#x4F7F;&#x7528; fs.writeFile() &#x4E0E;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;</a></li>
  </ul>
  </li>
  <li><a href="#fs_fs_writefilesync_file_data_options"><code>fs.writeFileSync(file, data[, options])</code></a></li>
  <li><a href="#fs_fs_writesync_fd_buffer_offset_length_position"><code>fs.writeSync(fd, buffer[, offset[, length[, position]]])</code></a></li>
  <li><a href="#fs_fs_writesync_fd_string_position_encoding"><code>fs.writeSync(fd, string[, position[, encoding]])</code></a></li>
  <li><a href="#fs_fs_writev_fd_buffers_position_callback"><code>fs.writev(fd, buffers[, position], callback)</code></a></li>
  <li><a href="#fs_fs_writevsync_fd_buffers_position"><code>fs.writevSync(fd, buffers[, position])</code></a></li>
  <li>
  <p><a href="#fs_fs_promises_api">fs &#x7684; Promise API</a></p>
  <ul>
  <li>
  <p><a href="#fs_class_filehandle">FileHandle &#x7C7B;</a></p>
  <ul>
  <li><a href="#fs_filehandle_appendfile_data_options"><code>filehandle.appendFile(data, options)</code></a></li>
  <li><a href="#fs_filehandle_chmod_mode"><code>filehandle.chmod(mode)</code></a></li>
  <li><a href="#fs_filehandle_chown_uid_gid"><code>filehandle.chown(uid, gid)</code></a></li>
  <li><a href="#fs_filehandle_close"><code>filehandle.close()</code></a></li>
  <li><a href="#fs_filehandle_datasync"><code>filehandle.datasync()</code></a></li>
  <li><a href="#fs_filehandle_fd"><code>filehandle.fd</code></a></li>
  <li><a href="#fs_filehandle_read_buffer_offset_length_position"><code>filehandle.read(buffer, offset, length, position)</code></a></li>
  <li><a href="#fs_filehandle_read_options"><code>filehandle.read(options)</code></a></li>
  <li><a href="#fs_filehandle_readfile_options"><code>filehandle.readFile(options)</code></a></li>
  <li><a href="#fs_filehandle_readv_buffers_position"><code>filehandle.readv(buffers[, position])</code></a></li>
  <li><a href="#fs_filehandle_stat_options"><code>filehandle.stat([options])</code></a></li>
  <li><a href="#fs_filehandle_sync"><code>filehandle.sync()</code></a></li>
  <li><a href="#fs_filehandle_truncate_len"><code>filehandle.truncate(len)</code></a></li>
  <li><a href="#fs_filehandle_utimes_atime_mtime"><code>filehandle.utimes(atime, mtime)</code></a></li>
  <li><a href="#fs_filehandle_write_buffer_offset_length_position"><code>filehandle.write(buffer[, offset[, length[, position]]])</code></a></li>
  <li><a href="#fs_filehandle_write_string_position_encoding"><code>filehandle.write(string[, position[, encoding]])</code></a></li>
  <li><a href="#fs_filehandle_writefile_data_options"><code>filehandle.writeFile(data, options)</code></a></li>
  <li><a href="#fs_filehandle_writev_buffers_position"><code>filehandle.writev(buffers[, position])</code></a></li>
  </ul>
  </li>
  <li><a href="#fs_fspromises_access_path_mode"><code>fsPromises.access(path[, mode])</code></a></li>
  <li><a href="#fs_fspromises_appendfile_path_data_options"><code>fsPromises.appendFile(path, data[, options])</code></a></li>
  <li><a href="#fs_fspromises_chmod_path_mode"><code>fsPromises.chmod(path, mode)</code></a></li>
  <li><a href="#fs_fspromises_chown_path_uid_gid"><code>fsPromises.chown(path, uid, gid)</code></a></li>
  <li><a href="#fs_fspromises_copyfile_src_dest_mode"><code>fsPromises.copyFile(src, dest[, mode])</code></a></li>
  <li><a href="#fs_fspromises_lchmod_path_mode"><code>fsPromises.lchmod(path, mode)</code></a></li>
  <li><a href="#fs_fspromises_lchown_path_uid_gid"><code>fsPromises.lchown(path, uid, gid)</code></a></li>
  <li><a href="#fs_fspromises_lutimes_path_atime_mtime"><code>fsPromises.lutimes(path, atime, mtime)</code></a></li>
  <li><a href="#fs_fspromises_link_existingpath_newpath"><code>fsPromises.link(existingPath, newPath)</code></a></li>
  <li><a href="#fs_fspromises_lstat_path_options"><code>fsPromises.lstat(path[, options])</code></a></li>
  <li><a href="#fs_fspromises_mkdir_path_options"><code>fsPromises.mkdir(path[, options])</code></a></li>
  <li><a href="#fs_fspromises_mkdtemp_prefix_options"><code>fsPromises.mkdtemp(prefix[, options])</code></a></li>
  <li><a href="#fs_fspromises_open_path_flags_mode"><code>fsPromises.open(path, flags[, mode])</code></a></li>
  <li><a href="#fs_fspromises_opendir_path_options"><code>fsPromises.opendir(path[, options])</code></a></li>
  <li><a href="#fs_fspromises_readdir_path_options"><code>fsPromises.readdir(path[, options])</code></a></li>
  <li><a href="#fs_fspromises_readfile_path_options"><code>fsPromises.readFile(path[, options])</code></a></li>
  <li><a href="#fs_fspromises_readlink_path_options"><code>fsPromises.readlink(path[, options])</code></a></li>
  <li><a href="#fs_fspromises_realpath_path_options"><code>fsPromises.realpath(path[, options])</code></a></li>
  <li><a href="#fs_fspromises_rename_oldpath_newpath"><code>fsPromises.rename(oldPath, newPath)</code></a></li>
  <li><span class="stability_1"><a href="#fs_fspromises_rmdir_path_options"><code>fsPromises.rmdir(path[, options])</code></a></span></li>
  <li><a href="#fs_fspromises_stat_path_options"><code>fsPromises.stat(path[, options])</code></a></li>
  <li><a href="#fs_fspromises_symlink_target_path_type"><code>fsPromises.symlink(target, path[, type])</code></a></li>
  <li><a href="#fs_fspromises_truncate_path_len"><code>fsPromises.truncate(path[, len])</code></a></li>
  <li><a href="#fs_fspromises_unlink_path"><code>fsPromises.unlink(path)</code></a></li>
  <li><a href="#fs_fspromises_utimes_path_atime_mtime"><code>fsPromises.utimes(path, atime, mtime)</code></a></li>
  <li><a href="#fs_fspromises_writefile_file_data_options"><code>fsPromises.writeFile(file, data[, options])</code></a></li>
  </ul>
  </li>
  <li>
  <p><a href="#fs_fs_constants_1">FS &#x5E38;&#x91CF;</a></p>
  <ul>
  <li><a href="#fs_file_access_constants">&#x6587;&#x4EF6;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x7684;&#x5E38;&#x91CF;</a></li>
  <li><a href="#fs_file_copy_constants">&#x6587;&#x4EF6;&#x62F7;&#x8D1D;&#x7684;&#x5E38;&#x91CF;</a></li>
  <li><a href="#fs_file_open_constants">&#x6587;&#x4EF6;&#x6253;&#x5F00;&#x7684;&#x5E38;&#x91CF;</a></li>
  <li><a href="#fs_file_type_constants">&#x6587;&#x4EF6;&#x7C7B;&#x578B;&#x7684;&#x5E38;&#x91CF;</a></li>
  <li><a href="#fs_file_mode_constants">&#x6587;&#x4EF6;&#x6A21;&#x5F0F;&#x7684;&#x5E38;&#x91CF;</a></li>
  </ul>
  </li>
  <li><a href="#fs_file_system_flags">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x6807;&#x5FD7;</a></li>
  </ul>
  </li>
  </ul>
          </div>
  
          <!-- <div id="biz_content">
            <a href="http://www.tp-shop.cn/index.php?http_referer=node" target="_blank">
              <img src="//static.nodejs.cn/_static/img/ad/api_content_tpshop.jpg" />
            </a>
          </div> -->
    
          <div id="apicontent">
            <h1>fs&#xFF08;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#xFF09;<span><a class="mark" href="#fs_file_system" id="fs_file_system">#</a></span></h1><p class="tip_wrap"><a href="/api/fs/file_system.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_system.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <!--introduced_in=v0.10.0-->
  <p></p><div class="api_stability api_stability_2"><a target="_blank" rel="nofollow" href="/api/documentation.html#documentation_stability_index">&#x7A33;&#x5B9A;&#x6027;: 2</a> - &#x7A33;&#x5B9A;</div><p></p>
  <!--name=fs-->
  <p><strong>&#x6E90;&#x4EE3;&#x7801;:</strong> <a target="_blank" href="https://github.com/nodejs/node/blob/v14.8.0/lib/fs.js">lib/fs.js</a></p>
  <p><code>fs</code> &#x6A21;&#x5757;&#x63D0;&#x4F9B;&#x4E86;&#x7528;&#x4E8E;&#x4E0E;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x8FDB;&#x884C;&#x4EA4;&#x4E92;&#xFF08;&#x4EE5;&#x7C7B;&#x4F3C;&#x4E8E;&#x6807;&#x51C6; POSIX &#x51FD;&#x6570;&#x7684;&#x65B9;&#x5F0F;&#xFF09;&#x7684; API&#x3002;</p>
  <p>&#x8981;&#x4F7F;&#x7528;&#x6B64;&#x6A21;&#x5757;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);</code></pre>
  <p>&#x6240;&#x6709;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x64CD;&#x4F5C;&#x90FD;&#x5177;&#x6709;&#x540C;&#x6B65;&#x548C;&#x5F02;&#x6B65;&#x7684;&#x5F62;&#x5F0F;&#x3002;</p>
  <p>&#x5F02;&#x6B65;&#x7684;&#x5F62;&#x5F0F;&#x603B;&#x662F;&#x628A;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x4F5C;&#x4E3A;&#x5176;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x3002;
  &#x4F20;&#x7ED9;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x7684;&#x53C2;&#x6570;&#x53D6;&#x51B3;&#x4E8E;&#x5177;&#x4F53;&#x65B9;&#x6CD5;&#xFF0C;&#x4F46;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x603B;&#x662F;&#x9884;&#x7559;&#x7ED9;&#x5F02;&#x5E38;&#x3002;
  &#x5982;&#x679C;&#x64CD;&#x4F5C;&#x88AB;&#x6210;&#x529F;&#x5730;&#x5B8C;&#x6210;&#xFF0C;&#x5219;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x4F1A;&#x4E3A; <code>null</code> &#x6216; <code>undefined</code>&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  
  fs.unlink(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x5DF2;&#x6210;&#x529F;&#x5730;&#x5220;&#x9664;&#x6587;&#x4EF6;&apos;</span>);
  });</code></pre>
  <p>&#x5F53;&#x4F7F;&#x7528;&#x540C;&#x6B65;&#x7684;&#x64CD;&#x4F5C;&#x65F6;&#xFF0C;&#x53D1;&#x751F;&#x7684;&#x5F02;&#x5E38;&#x4F1A;&#x88AB;&#x7ACB;&#x5373;&#x5730;&#x629B;&#x51FA;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>try&#x2026;catch</code> &#x5904;&#x7406;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x5192;&#x6CE1;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  
  <span class="hljs-keyword">try</span> {
    fs.unlinkSync(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>);
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x5DF2;&#x6210;&#x529F;&#x5730;&#x5220;&#x9664;&#x6587;&#x4EF6;&apos;</span>);
  } <span class="hljs-keyword">catch</span> (err) {
    <span class="hljs-comment">// &#x5904;&#x7406;&#x9519;&#x8BEF;</span>
  }</code></pre>
  <p>&#x5F53;&#x4F7F;&#x7528;&#x5F02;&#x6B65;&#x7684;&#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x65E0;&#x6CD5;&#x4FDD;&#x8BC1;&#x987A;&#x5E8F;&#x3002;
  &#x56E0;&#x6B64;&#xFF0C;&#x4EE5;&#x4E0B;&#x7684;&#x64CD;&#x4F5C;&#x5BB9;&#x6613;&#x51FA;&#x9519;&#xFF0C;&#x56E0;&#x4E3A; <code>fs.stat()</code> &#x64CD;&#x4F5C;&#x53EF;&#x80FD;&#x5728; <code>fs.rename()</code> &#x64CD;&#x4F5C;&#x4E4B;&#x524D;&#x5B8C;&#x6210;&#xFF1A;</p>
  <pre><code class="language-js">fs.rename(<span class="hljs-string">&apos;&#x65E7;&#x6587;&#x4EF6;&apos;</span>, <span class="hljs-string">&apos;&#x65B0;&#x6587;&#x4EF6;&apos;</span>, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x91CD;&#x547D;&#x540D;&#x5B8C;&#x6210;&apos;</span>);
  });
  fs.stat(<span class="hljs-string">&apos;&#x65B0;&#x6587;&#x4EF6;&apos;</span>, (err, stats) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`&#x6587;&#x4EF6;&#x5C5E;&#x6027;: <span class="hljs-subst">${<span class="hljs-built_in">JSON</span>.stringify(stats)}</span>`</span>);
  });</code></pre>
  <p>&#x82E5;&#x8981;&#x6B63;&#x786E;&#x5730;&#x6392;&#x5E8F;&#x8FD9;&#x4E9B;&#x64CD;&#x4F5C;&#xFF0C;&#x5219;&#x79FB;&#x52A8; <code>fs.stat()</code> &#x8C03;&#x7528;&#x5230; <code>fs.rename()</code> &#x64CD;&#x4F5C;&#x7684;&#x56DE;&#x8C03;&#x4E2D;&#xFF1A;</p>
  <pre><code class="language-js">fs.rename(<span class="hljs-string">&apos;&#x65E7;&#x6587;&#x4EF6;&apos;</span>, <span class="hljs-string">&apos;&#x65B0;&#x6587;&#x4EF6;&apos;</span>, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    fs.stat(<span class="hljs-string">&apos;&#x65B0;&#x6587;&#x4EF6;&apos;</span>, (err, stats) =&gt; {
      <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`&#x6587;&#x4EF6;&#x5C5E;&#x6027;: <span class="hljs-subst">${<span class="hljs-built_in">JSON</span>.stringify(stats)}</span>`</span>);
    });
  });</code></pre>
  <p>&#x5728;&#x7E41;&#x5FD9;&#x7684;&#x8FDB;&#x7A0B;&#x4E2D;&#xFF0C;&#x5E94;&#x4F7F;&#x7528;&#x8FD9;&#x4E9B;&#x8C03;&#x7528;&#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x3002;
  &#x540C;&#x6B65;&#x7684;&#x7248;&#x672C;&#x4F1A;&#x963B;&#x585E;&#x6574;&#x4E2A;&#x8FDB;&#x7A0B;&#xFF08;&#x505C;&#x6B62;&#x6240;&#x6709;&#x7684;&#x8FDE;&#x63A5;&#xFF09;&#xFF0C;&#x76F4;&#x5230;&#x5B83;&#x4EEC;&#x5B8C;&#x6210;&#x3002;</p>
  <p>&#x5927;&#x591A;&#x6570;&#x5F02;&#x6B65;&#x7684; <code>fs</code> &#x51FD;&#x6570;&#x90FD;&#x53EF;&#x4EE5;&#x7701;&#x7565;&#x56DE;&#x8C03;&#x53C2;&#x6570;&#x3002;
  &#x4F46;&#x662F;&#xFF0C;&#x4E0D;&#x5EFA;&#x8BAE;&#x8FD9;&#x4E48;&#x4F7F;&#x7528;&#x3002;
  &#x5F53;&#x7701;&#x7565;&#x56DE;&#x8C03;&#x65F6;&#xFF0C;&#x4F1A;&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x7684;&#x56DE;&#x8C03;&#x6765;&#x629B;&#x51FA;&#x9519;&#x8BEF;&#x3002;
  &#x82E5;&#x8981;&#x83B7;&#x53D6;&#x5BF9;&#x539F;&#x59CB;&#x8C03;&#x7528;&#x70B9;&#x7684;&#x8DDF;&#x8E2A;&#xFF0C;&#x5219;&#x8BBE;&#x7F6E; <code>NODE_DEBUG</code> &#x73AF;&#x5883;&#x53D8;&#x91CF;&#xFF1A;</p>
  <pre><code class="language-console"><span class="hljs-meta">$</span><span class="bash"> cat script.js</span>
  function bad() {
    require(&apos;fs&apos;).readFile(&apos;/&apos;);
  }
  bad();
  <span class="hljs-meta">
  $</span><span class="bash"> env NODE_DEBUG=fs node script.js</span>
  fs.js:88
          throw backtrace;
          ^
  Error: EISDIR: illegal operation on a directory, read
      &lt;stack trace.&gt;</code></pre>
  <h2>&#x6587;&#x4EF6;&#x8DEF;&#x5F84;<span><a class="mark" href="#fs_file_paths" id="fs_file_paths">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/file_paths.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_paths.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x5927;&#x591A;&#x6570; <code>fs</code> &#x64CD;&#x4F5C;&#x63A5;&#x53D7;&#x7684;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;&#x53EF;&#x4EE5;&#x6307;&#x5B9A;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x3001;<a href="/s/FApxjh" rel="nofollow"><code>Buffer</code></a>&#x3001;&#x6216; <a href="/s/5dwq7G" rel="nofollow"><code>URL</code></a> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002;</p>
  <p>&#x5B57;&#x7B26;&#x4E32;&#x5F62;&#x5F0F;&#x7684;&#x8DEF;&#x5F84;&#x4F1A;&#x88AB;&#x89E3;&#x91CA;&#x4E3A; UTF-8 &#x5B57;&#x7B26;&#x5E8F;&#x5217;&#xFF08;&#x6807;&#x8BC6;&#x7EDD;&#x5BF9;&#x6216;&#x76F8;&#x5BF9;&#x7684;&#x6587;&#x4EF6;&#x540D;&#xFF09;&#x3002;
  &#x76F8;&#x5BF9;&#x8DEF;&#x5F84;&#x4F1A;&#x76F8;&#x5BF9;&#x4E8E;&#x5F53;&#x524D;&#x5DE5;&#x4F5C;&#x76EE;&#x5F55;&#xFF08;&#x7531; <code>process.cwd()</code> &#x6307;&#x5B9A;&#xFF09;&#x8FDB;&#x884C;&#x5904;&#x7406;&#x3002;</p>
  <p>&#x5728; POSIX &#x4E0A;&#x4F7F;&#x7528;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x7684;&#x793A;&#x4F8B;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  
  fs.open(<span class="hljs-string">&apos;/&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;r&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    fs.close(fd, (err) =&gt; {
      <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    });
  });</code></pre>
  <p>&#x5728; POSIX &#x4E0A;&#x4F7F;&#x7528;&#x76F8;&#x5BF9;&#x8DEF;&#x5F84;&#xFF08;&#x76F8;&#x5BF9;&#x4E8E; <code>process.cwd()</code>&#xFF09;&#x7684;&#x793A;&#x4F8B;&#xFF1A;</p>
  <pre><code class="language-js">fs.open(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;r&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    fs.close(fd, (err) =&gt; {
      <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    });
  });</code></pre>
  <p>&#x4F7F;&#x7528; <a href="/s/FApxjh" rel="nofollow"><code>Buffer</code></a> &#x6307;&#x5B9A;&#x7684;&#x8DEF;&#x5F84;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x5C06;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;&#x89C6;&#x4E3A;&#x4E0D;&#x900F;&#x660E;&#x5B57;&#x8282;&#x5E8F;&#x5217;&#x7684;&#x67D0;&#x4E9B; POSIX &#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x3002;
  &#x5728;&#x8FD9;&#x4E9B;&#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x5355;&#x4E2A;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;&#x53EF;&#x4EE5;&#x5305;&#x542B;&#x4F7F;&#x7528;&#x591A;&#x79CD;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x7684;&#x5B50;&#x5E8F;&#x5217;&#x3002;
  &#x4E0E;&#x5B57;&#x7B26;&#x4E32;&#x8DEF;&#x5F84;&#x4E00;&#x6837;&#xFF0C; <code>Buffer</code> &#x8DEF;&#x5F84;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x76F8;&#x5BF9;&#x6216;&#x7EDD;&#x5BF9;&#x7684;&#xFF1A;</p>
  <p>&#x5728; POSIX &#x4E0A;&#x4F7F;&#x7528;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x7684;&#x793A;&#x4F8B;&#xFF1A;</p>
  <pre><code class="language-js">fs.open(Buffer.from(<span class="hljs-string">&apos;/&#x6587;&#x4EF6;.txt&apos;</span>), <span class="hljs-string">&apos;r&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    fs.close(fd, (err) =&gt; {
      <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    });
  });</code></pre>
  <p>&#x5728; Windows &#x4E0A;&#xFF0C;Node.js &#x9075;&#x5FAA;&#x72EC;&#x7ACB;&#x9A71;&#x52A8;&#x5668;&#x5DE5;&#x4F5C;&#x76EE;&#x5F55;&#x7684;&#x6982;&#x5FF5;&#x3002;
  &#x5F53;&#x4F7F;&#x7528;&#x6CA1;&#x6709;&#x53CD;&#x659C;&#x6760;&#x7684;&#x9A71;&#x52A8;&#x5668;&#x8DEF;&#x5F84;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x89C2;&#x5BDF;&#x5230;&#x6B64;&#x884C;&#x4E3A;&#x3002;
  &#x4F8B;&#x5982;&#xFF0C; <code>fs.readdirSync(&apos;C:\\&apos;)</code> &#x53EF;&#x80FD;&#x4F1A;&#x8FD4;&#x56DE;&#x4E0E; <code>fs.readdirSync(&apos;C:&apos;)</code> &#x4E0D;&#x540C;&#x7684;&#x7ED3;&#x679C;&#x3002;
  &#x8BE6;&#x89C1;<a href="/s/qMc4eE" rel="nofollow">&#x6B64; MSDN &#x9875;&#x9762;</a>&#x3002;</p>
  <h3>URL &#x5BF9;&#x8C61;&#x7684;&#x652F;&#x6301;<span><a class="mark" href="#fs_url_object_support" id="fs_url_object_support">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/url_object_support.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/url_object_support.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v7.6.0</span>
  </div>
  <p>&#x5BF9;&#x4E8E;&#x5927;&#x591A;&#x6570; <code>fs</code> &#x6A21;&#x5757;&#x7684;&#x51FD;&#x6570;&#xFF0C; <code>path</code> &#x6216; <code>filename</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x4F20;&#x5165; WHATWG <a href="/s/5dwq7G" rel="nofollow"><code>URL</code></a> &#x5BF9;&#x8C61;&#x3002;
  &#x4EC5;&#x652F;&#x6301;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#x7684; <a href="/s/5dwq7G" rel="nofollow"><code>URL</code></a> &#x5BF9;&#x8C61;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  <span class="hljs-keyword">const</span> fileUrl = <span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///&#x6587;&#x4EF6;&apos;</span>);
  
  fs.readFileSync(fileUrl);</code></pre>
  <p><code>file:</code> URL &#x59CB;&#x7EC8;&#x662F;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x3002;</p>
  <p>&#x4F7F;&#x7528; WHATWG <a href="/s/5dwq7G" rel="nofollow"><code>URL</code></a> &#x5BF9;&#x8C61;&#x53EF;&#x80FD;&#x4F1A;&#x91C7;&#x7528;&#x7279;&#x5B9A;&#x4E8E;&#x5E73;&#x53F0;&#x7684;&#x884C;&#x4E3A;&#x3002;</p>
  <p>&#x5728; Windows &#x4E0A;&#xFF0C;&#x5E26;&#x6709;&#x4E3B;&#x673A;&#x540D;&#x7684; <code>file:</code> URL &#x4F1A;&#x8F6C;&#x6362;&#x4E3A; UNC &#x8DEF;&#x5F84;&#xFF0C;&#x800C;&#x5E26;&#x6709;&#x9A71;&#x52A8;&#x5668;&#x53F7;&#x7684; <code>file:</code> URL &#x4F1A;&#x8F6C;&#x6362;&#x4E3A;&#x672C;&#x5730;&#x7684;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x3002;
  &#x6CA1;&#x6709;&#x4E3B;&#x673A;&#x540D;&#x548C;&#x9A71;&#x52A8;&#x5668;&#x53F7;&#x7684; <code>file:</code> URL &#x4F1A;&#x5BFC;&#x81F4;&#x629B;&#x51FA;&#x9519;&#x8BEF;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x5728; Windows &#x4E0A;&#xFF1A;</span>
  
  <span class="hljs-comment">// - &#x5E26;&#x6709;&#x4E3B;&#x673A;&#x540D;&#x7684; WHATWG &#x6587;&#x4EF6;&#x7684; URL &#x4F1A;&#x8F6C;&#x6362;&#x4E3A; UNC &#x8DEF;&#x5F84;&#x3002;</span>
  <span class="hljs-comment">// file://&#x4E3B;&#x673A;&#x540D;/&#x6587;&#x4EF6; =&gt; \\&#x4E3B;&#x673A;&#x540D;\&#x6587;&#x4EF6;</span>
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file://&#x4E3B;&#x673A;&#x540D;/&#x6587;&#x4EF6;&apos;</span>));
  
  <span class="hljs-comment">// - &#x5E26;&#x6709;&#x9A71;&#x52A8;&#x5668;&#x53F7;&#x7684; WHATWG &#x6587;&#x4EF6;&#x7684; URL &#x4F1A;&#x8F6C;&#x6362;&#x4E3A;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x3002;</span>
  <span class="hljs-comment">// file:///C:/&#x6587;&#x4EF6; =&gt; C:\&#x6587;&#x4EF6;</span>
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///C:/&#x6587;&#x4EF6;&apos;</span>));
  
  <span class="hljs-comment">// - &#x6CA1;&#x6709;&#x4E3B;&#x673A;&#x540D;&#x7684; WHATWG &#x6587;&#x4EF6;&#x7684; URL &#x5FC5;&#x987B;&#x5305;&#x542B;&#x9A71;&#x52A8;&#x5668;&#x53F7;&#x3002;</span>
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///&#x65E0;&#x9A71;&#x52A8;&#x5668;&#x53F7;/&#x6587;&#x4EF6;&apos;</span>));
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///&#x6587;&#x4EF6;&apos;</span>));
  <span class="hljs-comment">// TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must be absolute</span></code></pre>
  <p>&#x5E26;&#x6709;&#x9A71;&#x52A8;&#x5668;&#x53F7;&#x7684; <code>file:</code> URL &#x5FC5;&#x987B;&#x4F7F;&#x7528; <code>:</code> &#x4F5C;&#x4E3A;&#x9A71;&#x52A8;&#x5668;&#x53F7;&#x540E;&#x9762;&#x7684;&#x5206;&#x9694;&#x7B26;&#x3002;
  &#x4F7F;&#x7528;&#x5176;&#x4ED6;&#x5206;&#x9694;&#x7B26;&#x4F1A;&#x5BFC;&#x81F4;&#x629B;&#x51FA;&#x9519;&#x8BEF;&#x3002;</p>
  <p>&#x5728;&#x6240;&#x6709;&#x5176;&#x4ED6;&#x5E73;&#x53F0;&#x4E0A;&#xFF0C;&#x4E0D;&#x652F;&#x6301;&#x5E26;&#x6709;&#x4E3B;&#x673A;&#x540D;&#x7684; <code>file:</code> URL&#xFF0C;&#x4F7F;&#x7528;&#x65F6;&#x4F1A;&#x5BFC;&#x81F4;&#x629B;&#x51FA;&#x9519;&#x8BEF;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x5728;&#x5176;&#x4ED6;&#x5E73;&#x53F0;&#x4E0A;&#xFF1A;</span>
  
  <span class="hljs-comment">// - &#x4E0D;&#x652F;&#x6301;&#x5E26;&#x6709;&#x4E3B;&#x673A;&#x540D;&#x7684; WHATWG &#x6587;&#x4EF6;&#x7684; URL&#x3002;</span>
  <span class="hljs-comment">// file://&#x4E3B;&#x673A;&#x540D;/&#x6587;&#x4EF6; =&gt; &#x629B;&#x51FA;&#x9519;&#x8BEF;!</span>
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file://&#x4E3B;&#x673A;&#x540D;/&#x6587;&#x4EF6;&apos;</span>));
  <span class="hljs-comment">// TypeError [ERR_INVALID_FILE_URL_PATH]: must be absolute</span>
  
  <span class="hljs-comment">// - WHATWG &#x6587;&#x4EF6;&#x7684; URL &#x4F1A;&#x8F6C;&#x6362;&#x4E3A;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x3002;</span>
  <span class="hljs-comment">// file:///&#x6587;&#x4EF6; =&gt; /&#x6587;&#x4EF6;</span>
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///&#x6587;&#x4EF6;&apos;</span>));</code></pre>
  <p>&#x5305;&#x542B;&#x7F16;&#x7801;&#x540E;&#x7684;&#x659C;&#x6746;&#x5B57;&#x7B26;&#x7684; <code>file:</code> URL &#x5728;&#x6240;&#x6709;&#x5E73;&#x53F0;&#x4E0A;&#x90FD;&#x4F1A;&#x5BFC;&#x81F4;&#x629B;&#x51FA;&#x9519;&#x8BEF;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x5728; Windows &#x4E0A;&#xFF1A;</span>
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///C:/%2F&apos;</span>));
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///C:/%2f&apos;</span>));
  <span class="hljs-comment">/* TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must not include encoded
  \ or / characters */</span>
  
  <span class="hljs-comment">// &#x5728; POSIX &#x4E0A;&#xFF1A;</span>
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///%2F&apos;</span>));
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///%2f&apos;</span>));
  <span class="hljs-comment">/* TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must not include encoded
  / characters */</span></code></pre>
  <p>&#x5728; Windows &#x4E0A;&#xFF0C;&#x5305;&#x542B;&#x7F16;&#x7801;&#x540E;&#x7684;&#x53CD;&#x659C;&#x6746;&#x5B57;&#x7B26;&#x7684; <code>file:</code> URL &#x4F1A;&#x5BFC;&#x81F4;&#x629B;&#x51FA;&#x9519;&#x8BEF;&#xFF1A; </p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x5728; Windows &#x4E0A;&#xFF1A;</span>
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///C:/%5C&apos;</span>));
  fs.readFileSync(<span class="hljs-keyword">new</span> URL(<span class="hljs-string">&apos;file:///C:/%5c&apos;</span>));
  <span class="hljs-comment">/* TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must not include encoded
  \ or / characters */</span></code></pre>
  <h2>&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;<span><a class="mark" href="#fs_file_descriptors" id="fs_file_descriptors">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/file_descriptors.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_descriptors.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x5728; POSIX &#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x5BF9;&#x4E8E;&#x6BCF;&#x4E2A;&#x8FDB;&#x7A0B;&#xFF0C;&#x5185;&#x6838;&#x90FD;&#x7EF4;&#x62A4;&#x7740;&#x4E00;&#x5F20;&#x5F53;&#x524D;&#x6253;&#x5F00;&#x7740;&#x7684;&#x6587;&#x4EF6;&#x548C;&#x8D44;&#x6E90;&#x7684;&#x8868;&#x683C;&#x3002;
  &#x6BCF;&#x4E2A;&#x6253;&#x5F00;&#x7684;&#x6587;&#x4EF6;&#x90FD;&#x5206;&#x914D;&#x4E86;&#x4E00;&#x4E2A;&#x79F0;&#x4E3A;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x7684;&#x7B80;&#x5355;&#x7684;&#x6570;&#x5B57;&#x6807;&#x8BC6;&#x7B26;&#x3002;
  &#x5728;&#x7CFB;&#x7EDF;&#x5C42;&#xFF0C;&#x6240;&#x6709;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x64CD;&#x4F5C;&#x90FD;&#x4F7F;&#x7528;&#x8FD9;&#x4E9B;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x6765;&#x6807;&#x8BC6;&#x548C;&#x8DDF;&#x8E2A;&#x6BCF;&#x4E2A;&#x7279;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x3002;
  Windows &#x7CFB;&#x7EDF;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x4E2A;&#x867D;&#x7136;&#x4E0D;&#x540C;&#x4F46;&#x6982;&#x5FF5;&#x4E0A;&#x7C7B;&#x4F3C;&#x7684;&#x673A;&#x5236;&#x6765;&#x8DDF;&#x8E2A;&#x8D44;&#x6E90;&#x3002;
  &#x4E3A;&#x4E86;&#x7B80;&#x5316;&#x7528;&#x6237;&#x7684;&#x5DE5;&#x4F5C;&#xFF0C;Node.js &#x62BD;&#x8C61;&#x51FA;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x4E4B;&#x95F4;&#x7684;&#x7279;&#x5B9A;&#x5DEE;&#x5F02;&#xFF0C;&#x5E76;&#x4E3A;&#x6240;&#x6709;&#x6253;&#x5F00;&#x7684;&#x6587;&#x4EF6;&#x5206;&#x914D;&#x4E00;&#x4E2A;&#x6570;&#x5B57;&#x578B;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</p>
  <p><code>fs.open()</code> &#x65B9;&#x6CD5;&#x7528;&#x4E8E;&#x5206;&#x914D;&#x65B0;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;
  &#x4E00;&#x65E6;&#x88AB;&#x5206;&#x914D;&#xFF0C;&#x5219;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x53EF;&#x7528;&#x4E8E;&#x4ECE;&#x6587;&#x4EF6;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#x3001;&#x5411;&#x6587;&#x4EF6;&#x5199;&#x5165;&#x6570;&#x636E;&#x3001;&#x6216;&#x8BF7;&#x6C42;&#x5173;&#x4E8E;&#x6587;&#x4EF6;&#x7684;&#x4FE1;&#x606F;&#x3002;</p>
  <pre><code class="language-js">fs.open(<span class="hljs-string">&apos;/open/some/file.txt&apos;</span>, <span class="hljs-string">&apos;r&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    fs.fstat(fd, (err, stat) =&gt; {
      <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
      <span class="hljs-comment">// &#x4F7F;&#x7528;&#x6587;&#x4EF6;&#x5C5E;&#x6027;&#x3002;</span>
  
      <span class="hljs-comment">// &#x59CB;&#x7EC8;&#x5173;&#x95ED;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#xFF01;</span>
      fs.close(fd, (err) =&gt; {
        <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
      });
    });
  });</code></pre>
  <p>&#x5927;&#x591A;&#x6570;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x9650;&#x5236;&#x5728;&#x4EFB;&#x4F55;&#x7ED9;&#x5B9A;&#x65F6;&#x95F4;&#x5185;&#x53EF;&#x80FD;&#x6253;&#x5F00;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x7684;&#x6570;&#x91CF;&#xFF0C;&#x56E0;&#x6B64;&#x5F53;&#x64CD;&#x4F5C;&#x5B8C;&#x6210;&#x65F6;&#x5173;&#x95ED;&#x63CF;&#x8FF0;&#x7B26;&#x81F3;&#x5173;&#x91CD;&#x8981;&#x3002;
  &#x5982;&#x679C;&#x4E0D;&#x8FD9;&#x6837;&#x505A;&#x5C06;&#x5BFC;&#x81F4;&#x5185;&#x5B58;&#x6CC4;&#x6F0F;&#xFF0C;&#x6700;&#x7EC8;&#x5BFC;&#x81F4;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5D29;&#x6E83;&#x3002;</p>
  <h2>&#x7EBF;&#x7A0B;&#x6C60;&#x7684;&#x4F7F;&#x7528;<span><a class="mark" href="#fs_threadpool_usage" id="fs_threadpool_usage">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/threadpool_usage.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/threadpool_usage.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x6240;&#x6709;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; API&#xFF0C;&#x9664;&#x4E86; <code>fs.FSWatcher()</code> &#x548C;&#x90A3;&#x4E9B;&#x663E;&#x5F0F;&#x540C;&#x6B65;&#x7684;&#x4E4B;&#x5916;&#xFF0C;&#x90FD;&#x4F7F;&#x7528; libuv &#x7684;&#x7EBF;&#x7A0B;&#x6C60;&#xFF0C;&#x8FD9;&#x5BF9;&#x67D0;&#x4E9B;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x53EF;&#x80FD;&#x4F1A;&#x4EA7;&#x751F;&#x610F;&#x5916;&#x548C;&#x8D1F;&#x9762;&#x7684;&#x6027;&#x80FD;&#x5F71;&#x54CD;&#x3002;
  &#x6709;&#x5173;&#x66F4;&#x591A;&#x4FE1;&#x606F;&#xFF0C;&#x53C2;&#x89C1; <a href="/s/6DjmgS" rel="nofollow"><code>UV_THREADPOOL_SIZE</code></a> &#x6587;&#x6863;&#x3002;</p>
  <h2>fs.Dir &#x7C7B;<span><a class="mark" href="#fs_class_fs_dir" id="fs_class_fs_dir">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/class_fs_dir.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/class_fs_dir.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span>
  </div>
  <p>&#x8868;&#x793A;&#x76EE;&#x5F55;&#x6D41;&#x7684;&#x7C7B;&#x3002;</p>
  <p>&#x7531; <a href="/s/zomk1H" rel="nofollow"><code>fs.opendir()</code></a>&#x3001;<a href="/s/V6ipxZ" rel="nofollow"><code>fs.opendirSync()</code></a> &#x6216; <a href="/s/wUZTwT" rel="nofollow"><code>fsPromises.opendir()</code></a> &#x521B;&#x5EFA;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  
  <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">print</span>(<span class="hljs-params">path</span>) </span>{
    <span class="hljs-keyword">const</span> dir = <span class="hljs-keyword">await</span> fs.promises.opendir(path);
    <span class="hljs-keyword">for</span> <span class="hljs-keyword">await</span> (<span class="hljs-keyword">const</span> dirent <span class="hljs-keyword">of</span> dir) {
      <span class="hljs-built_in">console</span>.log(dirent.name);
    }
  }
  print(<span class="hljs-string">&apos;./&apos;</span>).catch(<span class="hljs-built_in">console</span>.error);</code></pre>
  <h3><code>dir.close()</code><span><a class="mark" href="#fs_dir_close" id="fs_dir_close">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dir_close.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dir_close.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x5173;&#x95ED;&#x76EE;&#x5F55;&#x7684;&#x5E95;&#x5C42;&#x8D44;&#x6E90;&#x53E5;&#x67C4;&#x3002;
  &#x540E;&#x7EED;&#x7684;&#x8BFB;&#x53D6;&#x4F1A;&#x5BFC;&#x81F4;&#x9519;&#x8BEF;&#x3002;</p>
  <p>&#x8FD4;&#x56DE; <code>Promise</code>&#xFF08;&#x5728;&#x8D44;&#x6E90;&#x88AB;&#x5173;&#x95ED;&#x4E4B;&#x540E;&#x4F1A;&#x88AB; resolve&#xFF09;&#x3002;</p>
  <h3><code>dir.close(callback)</code><span><a class="mark" href="#fs_dir_close_callback" id="fs_dir_close_callback">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dir_close_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dir_close_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span>
  </div>
  <ul>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x5173;&#x95ED;&#x76EE;&#x5F55;&#x7684;&#x5E95;&#x5C42;&#x8D44;&#x6E90;&#x53E5;&#x67C4;&#x3002;
  &#x540E;&#x7EED;&#x7684;&#x8BFB;&#x53D6;&#x4F1A;&#x5BFC;&#x81F4;&#x9519;&#x8BEF;&#x3002;</p>
  <p>&#x5173;&#x95ED;&#x8D44;&#x6E90;&#x53E5;&#x67C4;&#x4E4B;&#x540E;&#x5C06;&#x4F1A;&#x8C03;&#x7528; <code>callback</code>&#x3002;</p>
  <h3><code>dir.closeSync()</code><span><a class="mark" href="#fs_dir_closesync" id="fs_dir_closesync">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dir_closesync.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dir_closesync.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span>
  </div>
  <p>&#x540C;&#x6B65;&#x5730;&#x5173;&#x95ED;&#x76EE;&#x5F55;&#x7684;&#x5E95;&#x5C42;&#x8D44;&#x6E90;&#x53E5;&#x67C4;&#x3002;
  &#x540E;&#x7EED;&#x7684;&#x8BFB;&#x53D6;&#x4F1A;&#x5BFC;&#x81F4;&#x9519;&#x8BEF;&#x3002;</p>
  <h3><code>dir.path</code><span><a class="mark" href="#fs_dir_path" id="fs_dir_path">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dir_path.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dir_path.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span>
  </div>
  <ul>
  <li><a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  </ul>
  <p>&#x6B64;&#x76EE;&#x5F55;&#x7684;&#x53EA;&#x8BFB;&#x8DEF;&#x5F84;&#xFF0C;&#x4E0E;&#x63D0;&#x4F9B;&#x7ED9; <a href="/s/zomk1H" rel="nofollow"><code>fs.opendir()</code></a>&#x3001;<a href="/s/V6ipxZ" rel="nofollow"><code>fs.opendirSync()</code></a> &#x6216; <a href="/s/wUZTwT" rel="nofollow"><code>fsPromises.opendir()</code></a> &#x7684;&#x4E00;&#x6837;&#x3002;</p>
  <h3><code>dir.read()</code><span><a class="mark" href="#fs_dir_read" id="fs_dir_read">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dir_read.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dir_read.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: &#x5305;&#x542B; <a href="/s/mNLVJ7" target="_blank" rel="nofollow" class="type">&lt;fs.Dirent&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> &#x7684; <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x901A;&#x8FC7; <a href="/s/QvrbKw" rel="nofollow"><code>readdir(3)</code></a> &#x5F02;&#x6B65;&#x5730;&#x8BFB;&#x53D6;&#x4E0B;&#x4E00;&#x4E2A;&#x76EE;&#x5F55;&#x9879;&#x4F5C;&#x4E3A; <a href="/s/mNLVJ7" rel="nofollow"><code>fs.Dirent</code></a>&#x3002;</p>
  <p>&#x8BFB;&#x53D6;&#x5B8C;&#x6210;&#x4E4B;&#x540E;&#xFF0C;&#x5219;&#x4F1A;&#x8FD4;&#x56DE; <code>Promise</code>&#xFF08;resolve &#x65F6;&#x4F1A;&#x4F20;&#x5165; <a href="/s/mNLVJ7" rel="nofollow"><code>fs.Dirent</code></a> &#x6216; <code>null</code>&#xFF08;&#x5982;&#x679C;&#x8BFB;&#x53D6;&#x4E0D;&#x5230;&#x76EE;&#x5F55;&#x9879;&#xFF09;&#xFF09;&#x3002;</p>
  <p>&#x6B64;&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x4E0D;&#x9075;&#x5FAA;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x7684;&#x5E95;&#x5C42;&#x76EE;&#x5F55;&#x673A;&#x5236;&#x6240;&#x63D0;&#x4F9B;&#x7684;&#x7279;&#x5B9A;&#x987A;&#x5E8F;&#x3002;
  &#x904D;&#x5386;&#x76EE;&#x5F55;&#x65F6;&#x6DFB;&#x52A0;&#x6216;&#x5220;&#x9664;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x53EF;&#x80FD;&#x4F1A;&#x6216;&#x53EF;&#x80FD;&#x4E0D;&#x4F1A;&#x5305;&#x542B;&#x5728;&#x904D;&#x5386;&#x7684;&#x7ED3;&#x679C;&#x4E2D;&#x3002;</p>
  <h3><code>dir.read(callback)</code><span><a class="mark" href="#fs_dir_read_callback" id="fs_dir_read_callback">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dir_read_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dir_read_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span>
  </div>
  <ul>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>dirent</code> <a href="/s/mNLVJ7" target="_blank" rel="nofollow" class="type">&lt;fs.Dirent&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x901A;&#x8FC7; <a href="/s/QvrbKw" rel="nofollow"><code>readdir(3)</code></a> &#x5F02;&#x6B65;&#x5730;&#x8BFB;&#x53D6;&#x4E0B;&#x4E00;&#x4E2A;&#x76EE;&#x5F55;&#x9879;&#x4F5C;&#x4E3A; <a href="/s/mNLVJ7" rel="nofollow"><code>fs.Dirent</code></a>&#x3002;</p>
  <p>&#x8BFB;&#x53D6;&#x5B8C;&#x6210;&#x4E4B;&#x540E;&#xFF0C;&#x5219;&#x4F1A;&#x8C03;&#x7528; <code>callback</code>&#xFF08;&#x4F20;&#x5165; <a href="/s/mNLVJ7" rel="nofollow"><code>fs.Dirent</code></a> &#x6216; <code>null</code>&#xFF08;&#x5982;&#x679C;&#x8BFB;&#x53D6;&#x4E0D;&#x5230;&#x76EE;&#x5F55;&#x9879;&#xFF09;&#xFF09;&#x3002;</p>
  <p>&#x6B64;&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x4E0D;&#x9075;&#x5FAA;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x7684;&#x5E95;&#x5C42;&#x76EE;&#x5F55;&#x673A;&#x5236;&#x6240;&#x63D0;&#x4F9B;&#x7684;&#x7279;&#x5B9A;&#x987A;&#x5E8F;&#x3002;
  &#x904D;&#x5386;&#x76EE;&#x5F55;&#x65F6;&#x6DFB;&#x52A0;&#x6216;&#x5220;&#x9664;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x53EF;&#x80FD;&#x4F1A;&#x6216;&#x53EF;&#x80FD;&#x4E0D;&#x4F1A;&#x5305;&#x542B;&#x5728;&#x904D;&#x5386;&#x7684;&#x7ED3;&#x679C;&#x4E2D;&#x3002;</p>
  <h3><code>dir.readSync()</code><span><a class="mark" href="#fs_dir_readsync" id="fs_dir_readsync">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dir_readsync.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dir_readsync.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/mNLVJ7" target="_blank" rel="nofollow" class="type">&lt;fs.Dirent&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a></li>
  </ul>
  <p>&#x901A;&#x8FC7; <a href="/s/QvrbKw" rel="nofollow"><code>readdir(3)</code></a> &#x540C;&#x6B65;&#x5730;&#x8BFB;&#x53D6;&#x4E0B;&#x4E00;&#x4E2A;&#x76EE;&#x5F55;&#x9879;&#x4F5C;&#x4E3A; <a href="/s/mNLVJ7" rel="nofollow"><code>fs.Dirent</code></a>&#x3002;</p>
  <p>&#x5982;&#x679C;&#x8BFB;&#x53D6;&#x4E0D;&#x5230;&#x76EE;&#x5F55;&#x9879;&#xFF0C;&#x5219;&#x5C06;&#x4F1A;&#x8FD4;&#x56DE; <code>null</code>&#x3002;</p>
  <p>&#x6B64;&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x4E0D;&#x9075;&#x5FAA;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x7684;&#x5E95;&#x5C42;&#x76EE;&#x5F55;&#x673A;&#x5236;&#x6240;&#x63D0;&#x4F9B;&#x7684;&#x7279;&#x5B9A;&#x987A;&#x5E8F;&#x3002;
  &#x904D;&#x5386;&#x76EE;&#x5F55;&#x65F6;&#x6DFB;&#x52A0;&#x6216;&#x5220;&#x9664;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x53EF;&#x80FD;&#x4F1A;&#x6216;&#x53EF;&#x80FD;&#x4E0D;&#x4F1A;&#x5305;&#x542B;&#x5728;&#x904D;&#x5386;&#x7684;&#x7ED3;&#x679C;&#x4E2D;&#x3002;</p>
  <h3><code>dir[Symbol.asyncIterator]()</code><span><a class="mark" href="#fs_dir_symbol_asynciterator" id="fs_dir_symbol_asynciterator">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dir_symbol_asynciterator.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dir_symbol_asynciterator.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/mNLVJ7" target="_blank" rel="nofollow" class="type">&lt;fs.Dirent&gt;</a> &#x7684; <a href="/s/HnG4ws" target="_blank" rel="nofollow" class="type">&lt;AsyncIterator&gt;</a></li>
  </ul>
  <p>&#x901A;&#x8FC7; <a href="/s/QvrbKw" rel="nofollow"><code>readdir(3)</code></a> &#x5F02;&#x6B65;&#x5730;&#x904D;&#x5386;&#x76EE;&#x5F55;&#xFF0C;&#x76F4;&#x5230;&#x8BFB;&#x53D6;&#x4E86;&#x6240;&#x6709;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x3002;</p>
  <p>&#x5F02;&#x6B65;&#x8FED;&#x4EE3;&#x5668;&#x8FD4;&#x56DE;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x59CB;&#x7EC8;&#x4E3A; <a href="/s/mNLVJ7" rel="nofollow"><code>fs.Dirent</code></a>&#x3002;
  <code>dir.read()</code> &#x4E2D;&#x4E3A; <code>null</code> &#x7684;&#x60C5;&#x51B5;&#x4F1A;&#x5728;&#x5185;&#x90E8;&#x5904;&#x7406;&#x3002;</p>
  <p>&#x6709;&#x5173;&#x793A;&#x4F8B;&#xFF0C;&#x8BF7;&#x53C2;&#x89C1; <a href="/s/PrNiRv" rel="nofollow"><code>fs.Dir</code></a>&#x3002;</p>
  <p>&#x8BE5;&#x8FED;&#x4EE3;&#x5668;&#x8FD4;&#x56DE;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x4E0D;&#x9075;&#x5FAA;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x7684;&#x5E95;&#x5C42;&#x76EE;&#x5F55;&#x673A;&#x5236;&#x6240;&#x63D0;&#x4F9B;&#x7684;&#x7279;&#x5B9A;&#x987A;&#x5E8F;&#x3002;
  &#x904D;&#x5386;&#x76EE;&#x5F55;&#x65F6;&#x6DFB;&#x52A0;&#x6216;&#x5220;&#x9664;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x53EF;&#x80FD;&#x4F1A;&#x6216;&#x53EF;&#x80FD;&#x4E0D;&#x4F1A;&#x5305;&#x542B;&#x5728;&#x904D;&#x5386;&#x7684;&#x7ED3;&#x679C;&#x4E2D;&#x3002;</p>
  <h2>fs.Dirent &#x7C7B;<span><a class="mark" href="#fs_class_fs_dirent" id="fs_class_fs_dirent">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/class_fs_dirent.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/class_fs_dirent.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.10.0</span>
  </div>
  <p>&#x76EE;&#x5F55;&#x9879;&#xFF08;&#x53EF;&#x4EE5;&#x662F;&#x6587;&#x4EF6;&#x6216;&#x76EE;&#x5F55;&#x4E2D;&#x7684;&#x5B50;&#x76EE;&#x5F55;&#xFF09;&#x7684;&#x8868;&#x793A;&#xFF0C;&#x901A;&#x8FC7;&#x8BFB;&#x53D6; <a href="/s/PrNiRv" rel="nofollow"><code>fs.Dir</code></a> &#x8FD4;&#x56DE;&#x3002;
  &#x76EE;&#x5F55;&#x9879;&#x662F;&#x6587;&#x4EF6;&#x540D;&#x548C;&#x6587;&#x4EF6;&#x7C7B;&#x578B;&#x5BF9;&#x7684;&#x7EC4;&#x5408;&#x3002;</p>
  <p>&#x6B64;&#x5916;&#xFF0C;&#x5F53;&#x8C03;&#x7528; <a href="/s/Yvf5n5" rel="nofollow"><code>fs.readdir()</code></a> &#x6216; <a href="/s/Frjypi" rel="nofollow"><code>fs.readdirSync()</code></a>&#xFF08;<code>withFileTypes</code> &#x9009;&#x9879;&#x8BBE;&#x7F6E;&#x4E3A; <code>true</code>&#xFF09;&#x65F6;&#xFF0C;&#x5219;&#x751F;&#x6210;&#x7684;&#x6570;&#x7EC4;&#x4F1A;&#x4F7F;&#x7528; <code>fs.Dirent</code> &#x5BF9;&#x8C61;&#xFF08;&#x800C;&#x4E0D;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x6216; <code>Buffer</code>&#xFF09;&#x586B;&#x5145;&#x3002;</p>
  <h3><code>dirent.isBlockDevice()</code><span><a class="mark" href="#fs_dirent_isblockdevice" id="fs_dirent_isblockdevice">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dirent_isblockdevice.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dirent_isblockdevice.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.10.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Dirent</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x5757;&#x8BBE;&#x5907;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>dirent.isCharacterDevice()</code><span><a class="mark" href="#fs_dirent_ischaracterdevice" id="fs_dirent_ischaracterdevice">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dirent_ischaracterdevice.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dirent_ischaracterdevice.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.10.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Dirent</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x5B57;&#x7B26;&#x8BBE;&#x5907;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>dirent.isDirectory()</code><span><a class="mark" href="#fs_dirent_isdirectory" id="fs_dirent_isdirectory">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dirent_isdirectory.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dirent_isdirectory.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.10.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Dirent</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x76EE;&#x5F55;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>dirent.isFIFO()</code><span><a class="mark" href="#fs_dirent_isfifo" id="fs_dirent_isfifo">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dirent_isfifo.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dirent_isfifo.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.10.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Dirent</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x5148;&#x8FDB;&#x5148;&#x51FA;&#xFF08;FIFO&#xFF09;&#x7BA1;&#x9053;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>dirent.isFile()</code><span><a class="mark" href="#fs_dirent_isfile" id="fs_dirent_isfile">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dirent_isfile.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dirent_isfile.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.10.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Dirent</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x666E;&#x901A;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>dirent.isSocket()</code><span><a class="mark" href="#fs_dirent_issocket" id="fs_dirent_issocket">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dirent_issocket.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dirent_issocket.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.10.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Dirent</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x5957;&#x63A5;&#x5B57;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>dirent.isSymbolicLink()</code><span><a class="mark" href="#fs_dirent_issymboliclink" id="fs_dirent_issymboliclink">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dirent_issymboliclink.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dirent_issymboliclink.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.10.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Dirent</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>dirent.name</code><span><a class="mark" href="#fs_dirent_name" id="fs_dirent_name">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/dirent_name.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/dirent_name.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.10.0</span>
  </div>
  <ul>
  <li><a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  <p><code>fs.Dirent</code> &#x5BF9;&#x8C61;&#x6307;&#x5411;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x3002;
  &#x6B64;&#x503C;&#x7684;&#x7C7B;&#x578B;&#x53D6;&#x51B3;&#x4E8E;&#x4F20;&#x9012;&#x7ED9; <a href="/s/Yvf5n5" rel="nofollow"><code>fs.readdir()</code></a> &#x6216; <a href="/s/Frjypi" rel="nofollow"><code>fs.readdirSync()</code></a> &#x7684; <code>options.encoding</code>&#x3002;</p>
  <h2>fs.FSWatcher &#x7C7B;<span><a class="mark" href="#fs_class_fs_fswatcher" id="fs_class_fs_fswatcher">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/class_fs_fswatcher.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/class_fs_fswatcher.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.5.8</span>
  </div>
  <ul>
  <li>&#x7EE7;&#x627F;&#x81EA; <a href="/s/pGAddE" target="_blank" rel="nofollow" class="type">&lt;EventEmitter&gt;</a></li>
  </ul>
  <p>&#x6210;&#x529F;&#x8C03;&#x7528; <a href="/s/h2QY7Q" rel="nofollow"><code>fs.watch()</code></a> &#x65B9;&#x6CD5;&#x4F1A;&#x8FD4;&#x56DE;&#x65B0;&#x5EFA;&#x7684; <code>fs.FSWatcher</code> &#x5BF9;&#x8C61;&#x3002;</p>
  <p>&#x6BCF;&#x5F53;&#x6307;&#x5B9A;&#x76D1;&#x89C6;&#x7684;&#x6587;&#x4EF6;&#x88AB;&#x4FEE;&#x6539;&#x65F6;&#xFF0C;&#x6240;&#x6709;&#x7684; <code>fs.FSWatcher</code> &#x5BF9;&#x8C61;&#x90FD;&#x4F1A;&#x89E6;&#x53D1; <code>&apos;change&apos;</code> &#x4E8B;&#x4EF6;&#x3002;</p>
  <h3>&apos;change&apos; &#x4E8B;&#x4EF6;<span><a class="mark" href="#fs_event_change" id="fs_event_change">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/event_change.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/event_change.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.5.8</span>
  </div>
  <ul>
  <li><code>eventType</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x5DF2;&#x53D1;&#x751F;&#x7684;&#x66F4;&#x6539;&#x4E8B;&#x4EF6;&#x7684;&#x7C7B;&#x578B;&#x3002;</li>
  <li><code>filename</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> &#x66F4;&#x6539;&#x7684;&#x6587;&#x4EF6;&#x540D;&#xFF08;&#x5982;&#x679C;&#x76F8;&#x5173;&#x6216;&#x53EF;&#x7528;&#xFF09;&#x3002;</li>
  </ul>
  <p>&#x5F53;&#x76D1;&#x89C6;&#x7684;&#x76EE;&#x5F55;&#x6216;&#x6587;&#x4EF6;&#x4E2D;&#x53D1;&#x751F;&#x66F4;&#x6539;&#x65F6;&#x89E6;&#x53D1;&#x3002;
  &#x5728; <a href="/s/h2QY7Q" rel="nofollow"><code>fs.watch()</code></a> &#x4E2D;&#x67E5;&#x770B;&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#x3002;</p>
  <p>&#x53EF;&#x80FD;&#x4E0D;&#x63D0;&#x4F9B; <code>filename</code> &#x53C2;&#x6570;&#xFF0C;&#x8FD9;&#x53D6;&#x51B3;&#x4E8E;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x7684;&#x652F;&#x6301;&#x3002;
  &#x5982;&#x679C;&#x63D0;&#x4F9B;&#x4E86; <code>filename</code>&#xFF0C;&#x5219;&#x5F53;&#x8C03;&#x7528; <code>fs.watch()</code> &#x5E76;&#x5C06;&#x5176; <code>encoding</code> &#x9009;&#x9879;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code> &#x65F6;&#xFF0C; <code>filename</code> &#x5C06;&#x662F;&#x4E00;&#x4E2A; <code>Buffer</code>&#xFF0C;&#x5426;&#x5219; <code>filename</code> &#x5C06;&#x662F; UTF-8 &#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x4F7F;&#x7528; fs.watch&#xFF08;&#xFF09;&#x76D1;&#x542C;&#x5668;&#x7684;&#x793A;&#x4F8B;&#x3002;</span>
  fs.watch(<span class="hljs-string">&apos;./tmp&apos;</span>, { <span class="hljs-attr">encoding</span>: <span class="hljs-string">&apos;buffer&apos;</span> }, (eventType, filename) =&gt; {
    <span class="hljs-keyword">if</span> (filename) {
      <span class="hljs-built_in">console</span>.log(filename);
      <span class="hljs-comment">// &#x6253;&#x5370;: &lt;Buffer ...&gt;</span>
    }
  });</code></pre>
  <h3>&apos;close&apos; &#x4E8B;&#x4EF6;<span><a class="mark" href="#fs_event_close" id="fs_event_close">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/event_close.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/event_close.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <p>&#x5F53;&#x76D1;&#x89C6;&#x5668;&#x505C;&#x6B62;&#x76D1;&#x89C6;&#x66F4;&#x6539;&#x65F6;&#x89E6;&#x53D1;&#x3002;
  &#x5173;&#x95ED;&#x7684; <code>fs.FSWatcher</code> &#x5BF9;&#x8C61;&#x5728;&#x4E8B;&#x4EF6;&#x5904;&#x7406;&#x51FD;&#x6570;&#x4E2D;&#x4E0D;&#x518D;&#x53EF;&#x7528;&#x3002;</p>
  <h3>&apos;error&apos; &#x4E8B;&#x4EF6;<span><a class="mark" href="#fs_event_error" id="fs_event_error">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/event_error.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/event_error.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.5.8</span>
  </div>
  <ul>
  <li><code>error</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  <p>&#x5F53;&#x76D1;&#x89C6;&#x6587;&#x4EF6;&#x65F6;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#x65F6;&#x89E6;&#x53D1;&#x3002;
  &#x53D1;&#x751F;&#x9519;&#x8BEF;&#x7684; <code>fs.FSWatcher</code> &#x5BF9;&#x8C61;&#x5728;&#x4E8B;&#x4EF6;&#x5904;&#x7406;&#x51FD;&#x6570;&#x4E2D;&#x4E0D;&#x518D;&#x53EF;&#x7528;&#x3002;</p>
  <h3><code>watcher.close()</code><span><a class="mark" href="#fs_watcher_close" id="fs_watcher_close">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/watcher_close.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/watcher_close.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.5.8</span>
  </div>
  <p>&#x7ED9;&#x5B9A;&#x7684; <code>fs.FSWatcher</code> &#x505C;&#x6B62;&#x76D1;&#x89C6;&#x66F4;&#x6539;&#x3002;
  &#x4E00;&#x65E6;&#x505C;&#x6B62;&#xFF0C;&#x5219; <code>fs.FSWatcher</code> &#x5BF9;&#x8C61;&#x5C06;&#x4E0D;&#x518D;&#x53EF;&#x7528;&#x3002;</p>
  <h3><code>watcher.ref()</code><span><a class="mark" href="#fs_watcher_ref" id="fs_watcher_ref">#</a></span></h3><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/watcher_ref.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.3.0</span>
  </div>
  <ul>
  <li>Returns: <a href="/s/8XNtAD" target="_blank" rel="nofollow" class="type">&lt;fs.FSWatcher&gt;</a></li>
  </ul>
  <p>When called, requests that the Node.js event loop <em>not</em> exit so long as the
  <code>FSWatcher</code> is active. Calling <code>watcher.ref()</code> multiple times will have
  no effect.</p>
  <p>By default, all <code>FSWatcher</code> objects are &quot;ref&apos;ed&quot;, making it normally
  unnecessary to call <code>watcher.ref()</code> unless <code>watcher.unref()</code> had been
  called previously.</p>
  <h3><code>watcher.unref()</code><span><a class="mark" href="#fs_watcher_unref" id="fs_watcher_unref">#</a></span></h3><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/watcher_unref.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.3.0</span>
  </div>
  <ul>
  <li>Returns: <a href="/s/8XNtAD" target="_blank" rel="nofollow" class="type">&lt;fs.FSWatcher&gt;</a></li>
  </ul>
  <p>When called, the active <code>FSWatcher</code> object will not require the Node.js
  event loop to remain active. If there is no other activity keeping the
  event loop running, the process may exit before the <code>FSWatcher</code> object&apos;s
  callback is invoked. Calling <code>watcher.unref()</code> multiple times will have
  no effect.</p>
  <h2>fs.StatWatcher &#x7C7B;<span><a class="mark" href="#fs_class_fs_statwatcher" id="fs_class_fs_statwatcher">#</a></span></h2><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/class_fs_statwatcher.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.3.0</span>
  </div>
  <ul>
  <li>Extends <a href="/s/pGAddE" target="_blank" rel="nofollow" class="type">&lt;EventEmitter&gt;</a></li>
  </ul>
  <p>A successful call to <code>fs.watchFile()</code> method will return a new <code>fs.StatWatcher</code>
  object.</p>
  <h3><code>watcher.ref()</code><span><a class="mark" href="#fs_watcher_ref_1" id="fs_watcher_ref_1">#</a></span></h3><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/watcher_ref_1.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.3.0</span>
  </div>
  <ul>
  <li>Returns: <a href="/s/EtjXhr" target="_blank" rel="nofollow" class="type">&lt;fs.StatWatcher&gt;</a></li>
  </ul>
  <p>When called, requests that the Node.js event loop <em>not</em> exit so long as the
  <code>StatWatcher</code> is active. Calling <code>watcher.ref()</code> multiple times will have
  no effect.</p>
  <p>By default, all <code>StatWatcher</code> objects are &quot;ref&apos;ed&quot;, making it normally
  unnecessary to call <code>watcher.ref()</code> unless <code>watcher.unref()</code> had been
  called previously.</p>
  <h3><code>watcher.unref()</code><span><a class="mark" href="#fs_watcher_unref_1" id="fs_watcher_unref_1">#</a></span></h3><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/watcher_unref_1.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.3.0</span>
  </div>
  <ul>
  <li>Returns: <a href="/s/EtjXhr" target="_blank" rel="nofollow" class="type">&lt;fs.StatWatcher&gt;</a></li>
  </ul>
  <p>When called, the active <code>StatWatcher</code> object will not require the Node.js
  event loop to remain active. If there is no other activity keeping the
  event loop running, the process may exit before the <code>StatWatcher</code> object&apos;s
  callback is invoked. Calling <code>watcher.unref()</code> multiple times will have
  no effect.</p>
  <h2>fs.ReadStream &#x7C7B;<span><a class="mark" href="#fs_class_fs_readstream" id="fs_class_fs_readstream">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/class_fs_readstream.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/class_fs_readstream.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.93</span>
  </div>
  <ul>
  <li>&#x7EE7;&#x627F;&#x81EA;: <a href="/s/YuDKX1" target="_blank" rel="nofollow" class="type">&lt;stream.Readable&gt;</a></li>
  </ul>
  <p>&#x4F7F;&#x7528; <a href="/s/wiVPXD" rel="nofollow"><code>fs.createReadStream()</code></a> &#x51FD;&#x6570;&#x521B;&#x5EFA;&#x5E76;&#x8FD4;&#x56DE;&#x7684; <code>fs.ReadStream</code> &#x5B9E;&#x4F8B;&#x3002;</p>
  <h3>&apos;close&apos; &#x4E8B;&#x4EF6;<span><a class="mark" href="#fs_event_close_1" id="fs_event_close_1">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/event_close_1.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/event_close_1.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.93</span>
  </div>
  <p>&#x5F53; <code>fs.ReadStream</code> &#x7684;&#x5E95;&#x5C42;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x5DF2;&#x5173;&#x95ED;&#x65F6;&#x89E6;&#x53D1;&#x3002;</p>
  <h3>&apos;open&apos; &#x4E8B;&#x4EF6;<span><a class="mark" href="#fs_event_open" id="fs_event_open">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/event_open.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/event_open.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.93</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <code>ReadStream</code> &#x4F7F;&#x7528;&#x7684;&#x6574;&#x6570;&#x578B;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  </ul>
  <p>&#x5F53; <code>fs.ReadStream</code> &#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x6253;&#x5F00;&#x65F6;&#x89E6;&#x53D1;&#x3002;</p>
  <h3>&apos;ready&apos; &#x4E8B;&#x4EF6;<span><a class="mark" href="#fs_event_ready" id="fs_event_ready">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/event_ready.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/event_ready.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v9.11.0</span>
  </div>
  <p>&#x5F53; <code>fs.ReadStream</code> &#x51C6;&#x5907;&#x597D;&#x4F7F;&#x7528;&#x65F6;&#x89E6;&#x53D1;&#x3002;</p>
  <p><code>&apos;open&apos;</code> &#x4E8B;&#x4EF6;&#x4E4B;&#x540E;&#x7ACB;&#x5373;&#x89E6;&#x53D1;&#x3002;</p>
  <h3><code>readStream.bytesRead</code><span><a class="mark" href="#fs_readstream_bytesread" id="fs_readstream_bytesread">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/readstream_bytesread.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/readstream_bytesread.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v6.4.0</span>
  </div>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a></li>
  </ul>
  <p>&#x5230;&#x76EE;&#x524D;&#x4E3A;&#x6B62;&#x5DF2;&#x8BFB;&#x53D6;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</p>
  <h3><code>readStream.path</code><span><a class="mark" href="#fs_readstream_path" id="fs_readstream_path">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/readstream_path.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/readstream_path.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.93</span>
  </div>
  <ul>
  <li><a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  <p>&#x6D41;&#x6B63;&#x5728;&#x8BFB;&#x53D6;&#x7684;&#x6587;&#x4EF6;&#x7684;&#x8DEF;&#x5F84;&#xFF0C;&#x7531; <code>fs.createReadStream()</code> &#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x6307;&#x5B9A;&#x3002;
  &#x5982;&#x679C; <code>path</code> &#x4F20;&#x5165;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219; <code>readStream.path</code> &#x5C06;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x3002;
  &#x5982;&#x679C; <code>path</code> &#x4F20;&#x5165; <code>Buffer</code>&#xFF0C;&#x5219; <code>readStream.path</code> &#x5C06;&#x662F; <code>Buffer</code>&#x3002;</p>
  <h3><code>readStream.pending</code><span><a class="mark" href="#fs_readstream_pending" id="fs_readstream_pending">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/readstream_pending.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/readstream_pending.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v11.2.0, v10.16.0</span>
  </div>
  <ul>
  <li><a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C;&#x5E95;&#x5C42;&#x7684;&#x6587;&#x4EF6;&#x8FD8;&#x672A;&#x88AB;&#x6253;&#x5F00;&#xFF08;&#x5373;&#x5728;&#x89E6;&#x53D1; <code>&apos;ready&apos;</code> &#x4E8B;&#x4EF6;&#x4E4B;&#x524D;&#xFF09;&#xFF0C;&#x5219;&#x6B64;&#x5C5E;&#x6027;&#x4E3A; <code>true</code>&#x3002;</p>
  <h2>fs.Stats &#x7C7B;<span><a class="mark" href="#fs_class_fs_stats" id="fs_class_fs_stats">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/class_fs_stats.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/class_fs_stats.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v8.1.0</td>
  <td><p>&#x65B0;&#x589E;&#x6570;&#x503C;&#x578B;&#x7684;&#x65F6;&#x95F4;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <p><code>fs.Stats</code> &#x5BF9;&#x8C61;&#x63D0;&#x4F9B;&#x4E86;&#x5173;&#x4E8E;&#x6587;&#x4EF6;&#x7684;&#x4FE1;&#x606F;&#x3002;</p>
  <p>&#x4ECE; <a href="/s/fdrjxj" rel="nofollow"><code>fs.stat()</code></a>&#x3001;<a href="/s/JqRZuK" rel="nofollow"><code>fs.lstat()</code></a>&#x3001;<a href="/s/MopJ4a" rel="nofollow"><code>fs.fstat()</code></a>&#x3001;&#x4EE5;&#x53CA;&#x5B83;&#x4EEC;&#x7684;&#x540C;&#x6B65;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x7684;&#x5BF9;&#x8C61;&#x90FD;&#x662F;&#x6B64;&#x7C7B;&#x578B;&#x3002;
  &#x5982;&#x679C;&#x4F20;&#x7ED9;&#x8FD9;&#x4E9B;&#x65B9;&#x6CD5;&#x7684; <code>options</code> &#x4E2D;&#x7684; <code>bigint</code> &#x4E3A; true&#xFF0C;&#x5219;&#x6570;&#x503C;&#x4F1A;&#x662F; <code>bigint</code> &#x578B;&#x800C;&#x4E0D;&#x662F; <code>number</code> &#x578B;&#xFF0C;&#x5E76;&#x4E14;&#x8BE5;&#x5BF9;&#x8C61;&#x8FD8;&#x4F1A;&#x5305;&#x542B;&#x989D;&#x5916;&#x7684;&#x7EB3;&#x79D2;&#x7EA7;&#x7CBE;&#x5EA6;&#x7684;&#x5C5E;&#x6027;&#xFF08;&#x4EE5; <code>Ns</code> &#x4E3A;&#x540E;&#x7F00;&#xFF09;&#x3002;</p>
  <pre><code class="language-console">Stats {
    dev: 2114,
    ino: 48064969,
    mode: 33188,
    nlink: 1,
    uid: 85,
    gid: 100,
    rdev: 0,
    size: 527,
    blksize: 4096,
    blocks: 8,
    atimeMs: 1318289051000.1,
    mtimeMs: 1318289051000.1,
    ctimeMs: 1318289051000.1,
    birthtimeMs: 1318289051000.1,
    atime: Mon, 10 Oct 2011 23:24:11 GMT,
    mtime: Mon, 10 Oct 2011 23:24:11 GMT,
    ctime: Mon, 10 Oct 2011 23:24:11 GMT,
    birthtime: Mon, 10 Oct 2011 23:24:11 GMT }</code></pre>
  <p><code>bigint</code> &#x7684;&#x7248;&#x672C;&#xFF1A;</p>
  <pre><code class="language-console">BigIntStats {
    dev: 2114n,
    ino: 48064969n,
    mode: 33188n,
    nlink: 1n,
    uid: 85n,
    gid: 100n,
    rdev: 0n,
    size: 527n,
    blksize: 4096n,
    blocks: 8n,
    atimeMs: 1318289051000n,
    mtimeMs: 1318289051000n,
    ctimeMs: 1318289051000n,
    birthtimeMs: 1318289051000n,
    atimeNs: 1318289051000000000n,
    mtimeNs: 1318289051000000000n,
    ctimeNs: 1318289051000000000n,
    birthtimeNs: 1318289051000000000n,
    atime: Mon, 10 Oct 2011 23:24:11 GMT,
    mtime: Mon, 10 Oct 2011 23:24:11 GMT,
    ctime: Mon, 10 Oct 2011 23:24:11 GMT,
    birthtime: Mon, 10 Oct 2011 23:24:11 GMT }</code></pre>
  <h3><code>stats.isBlockDevice()</code><span><a class="mark" href="#fs_stats_isblockdevice" id="fs_stats_isblockdevice">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_isblockdevice.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_isblockdevice.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.10</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> </li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Stats</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x5757;&#x8BBE;&#x5907;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>stats.isCharacterDevice()</code><span><a class="mark" href="#fs_stats_ischaracterdevice" id="fs_stats_ischaracterdevice">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_ischaracterdevice.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_ischaracterdevice.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.10</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Stats</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x5B57;&#x7B26;&#x8BBE;&#x5907;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>stats.isDirectory()</code><span><a class="mark" href="#fs_stats_isdirectory" id="fs_stats_isdirectory">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_isdirectory.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_isdirectory.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.10</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Stats</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x76EE;&#x5F55;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>stats.isFIFO()</code><span><a class="mark" href="#fs_stats_isfifo" id="fs_stats_isfifo">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_isfifo.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_isfifo.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.10</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Stats</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x5148;&#x8FDB;&#x5148;&#x51FA;&#xFF08;FIFO&#xFF09;&#x7BA1;&#x9053;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>stats.isFile()</code><span><a class="mark" href="#fs_stats_isfile" id="fs_stats_isfile">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_isfile.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_isfile.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.10</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Stats</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x666E;&#x901A;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>stats.isSocket()</code><span><a class="mark" href="#fs_stats_issocket" id="fs_stats_issocket">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_issocket.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_issocket.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.10</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Stats</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x5957;&#x63A5;&#x5B57;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <h3><code>stats.isSymbolicLink()</code><span><a class="mark" href="#fs_stats_issymboliclink" id="fs_stats_issymboliclink">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_issymboliclink.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_issymboliclink.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.10</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C; <code>fs.Stats</code> &#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#x3002;</p>
  <p>&#x6B64;&#x65B9;&#x6CD5;&#x4EC5;&#x5728;&#x4F7F;&#x7528; <a href="/s/JqRZuK" rel="nofollow"><code>fs.lstat()</code></a> &#x65F6;&#x6709;&#x6548;&#x3002;</p>
  <h3><code>stats.dev</code><span><a class="mark" href="#fs_stats_dev" id="fs_stats_dev">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_dev.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_dev.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a> </li>
  </ul>
  <p>&#x5305;&#x542B;&#x8BE5;&#x6587;&#x4EF6;&#x7684;&#x8BBE;&#x5907;&#x7684;&#x6570;&#x5B57;&#x6807;&#x8BC6;&#x7B26;&#x3002;</p>
  <h3><code>stats.ino</code><span><a class="mark" href="#fs_stats_ino" id="fs_stats_ino">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_ino.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_ino.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a> </li>
  </ul>
  <p>&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x7279;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x7D22;&#x5F15;&#x8282;&#x70B9;&#x7F16;&#x53F7;&#x3002;</p>
  <h3><code>stats.mode</code><span><a class="mark" href="#fs_stats_mode" id="fs_stats_mode">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a> </li>
  </ul>
  <p>&#x63CF;&#x8FF0;&#x6587;&#x4EF6;&#x7C7B;&#x578B;&#x548C;&#x6A21;&#x5F0F;&#x7684;&#x4F4D;&#x5B57;&#x6BB5;&#x3002;</p>
  <h3><code>stats.nlink</code><span><a class="mark" href="#fs_stats_nlink" id="fs_stats_nlink">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_nlink.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_nlink.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x6587;&#x4EF6;&#x5B58;&#x5728;&#x7684;&#x786C;&#x94FE;&#x63A5;&#x6570;&#x3002;</p>
  <h3><code>stats.uid</code><span><a class="mark" href="#fs_stats_uid" id="fs_stats_uid">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_uid.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_uid.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x62E5;&#x6709;&#x8BE5;&#x6587;&#x4EF6;&#xFF08;POSIX&#xFF09;&#x7684;&#x7528;&#x6237;&#x7684;&#x6570;&#x5B57;&#x578B;&#x7528;&#x6237;&#x6807;&#x8BC6;&#x7B26;&#x3002;</p>
  <h3><code>stats.gid</code><span><a class="mark" href="#fs_stats_gid" id="fs_stats_gid">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_gid.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_gid.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x62E5;&#x6709;&#x8BE5;&#x6587;&#x4EF6;&#xFF08;POSIX&#xFF09;&#x7684;&#x7FA4;&#x7EC4;&#x7684;&#x6570;&#x5B57;&#x578B;&#x7FA4;&#x7EC4;&#x6807;&#x8BC6;&#x7B26;&#x3002;</p>
  <h3><code>stats.rdev</code><span><a class="mark" href="#fs_stats_rdev" id="fs_stats_rdev">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_rdev.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_rdev.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C;&#x6587;&#x4EF6;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x8BBE;&#x5907;&#xFF0C;&#x5219;&#x6B64;&#x503C;&#x4E3A;&#x6570;&#x5B57;&#x578B;&#x8BBE;&#x5907;&#x6807;&#x8BC6;&#x7B26;&#x3002;</p>
  <h3><code>stats.size</code><span><a class="mark" href="#fs_stats_size" id="fs_stats_size">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_size.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_size.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x6587;&#x4EF6;&#x7684;&#x5927;&#x5C0F;&#xFF08;&#x4EE5;&#x5B57;&#x8282;&#x4E3A;&#x5355;&#x4F4D;&#xFF09;&#x3002;</p>
  <h3><code>stats.blksize</code><span><a class="mark" href="#fs_stats_blksize" id="fs_stats_blksize">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_blksize.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_blksize.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x7528;&#x4E8E; I/O &#x64CD;&#x4F5C;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x5757;&#x7684;&#x5927;&#x5C0F;&#x3002;</p>
  <h3><code>stats.blocks</code><span><a class="mark" href="#fs_stats_blocks" id="fs_stats_blocks">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_blocks.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_blocks.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x4E3A;&#x6B64;&#x6587;&#x4EF6;&#x5206;&#x914D;&#x7684;&#x5757;&#x6570;&#x3002;</p>
  <h3><code>stats.atimeMs</code><span><a class="mark" href="#fs_stats_atimems" id="fs_stats_atimems">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_atimems.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_atimems.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v8.1.0</span>
  </div>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x8868;&#x660E;&#x4E0A;&#x6B21;&#x8BBF;&#x95EE;&#x6B64;&#x6587;&#x4EF6;&#x7684;&#x65F6;&#x95F4;&#x6233;&#xFF0C;&#x4EE5; POSIX &#x7EAA;&#x5143;&#x4EE5;&#x6765;&#x7684;&#x6BEB;&#x79D2;&#x6570;&#x8868;&#x793A;&#x3002;</p>
  <h3><code>stats.mtimeMs</code><span><a class="mark" href="#fs_stats_mtimems" id="fs_stats_mtimems">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_mtimems.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_mtimems.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v8.1.0</span>
  </div>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x8868;&#x660E;&#x4E0A;&#x6B21;&#x4FEE;&#x6539;&#x6B64;&#x6587;&#x4EF6;&#x7684;&#x65F6;&#x95F4;&#x6233;&#xFF0C;&#x4EE5; POSIX &#x7EAA;&#x5143;&#x4EE5;&#x6765;&#x7684;&#x6BEB;&#x79D2;&#x6570;&#x8868;&#x793A;&#x3002;</p>
  <h3><code>stats.ctimeMs</code><span><a class="mark" href="#fs_stats_ctimems" id="fs_stats_ctimems">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_ctimems.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_ctimems.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v8.1.0</span>
  </div>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a> </li>
  </ul>
  <p>&#x8868;&#x660E;&#x4E0A;&#x6B21;&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x72B6;&#x6001;&#x7684;&#x65F6;&#x95F4;&#x6233;&#xFF0C;&#x4EE5; POSIX &#x7EAA;&#x5143;&#x4EE5;&#x6765;&#x7684;&#x6BEB;&#x79D2;&#x6570;&#x8868;&#x793A;&#x3002;</p>
  <h3><code>stats.birthtimeMs</code><span><a class="mark" href="#fs_stats_birthtimems" id="fs_stats_birthtimems">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_birthtimems.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_birthtimems.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v8.1.0</span>
  </div>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>&#x8868;&#x660E;&#x6B64;&#x6587;&#x4EF6;&#x7684;&#x521B;&#x5EFA;&#x65F6;&#x95F4;&#x7684;&#x65F6;&#x95F4;&#x6233;&#xFF0C;&#x4EE5; POSIX &#x7EAA;&#x5143;&#x4EE5;&#x6765;&#x7684;&#x6BEB;&#x79D2;&#x6570;&#x8868;&#x793A;&#x3002;</p>
  <h3><code>stats.atimeNs</code><span><a class="mark" href="#fs_stats_atimens" id="fs_stats_atimens">#</a></span></h3><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_atimens.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.10.0</span>
  </div>
  <ul>
  <li><a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>Only present when <code>bigint: true</code> is passed into the method that generates
  the object.
  The timestamp indicating the last time this file was accessed expressed in
  nanoseconds since the POSIX Epoch.</p>
  <h3><code>stats.mtimeNs</code><span><a class="mark" href="#fs_stats_mtimens" id="fs_stats_mtimens">#</a></span></h3><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_mtimens.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.10.0</span>
  </div>
  <ul>
  <li><a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>Only present when <code>bigint: true</code> is passed into the method that generates
  the object.
  The timestamp indicating the last time this file was modified expressed in
  nanoseconds since the POSIX Epoch.</p>
  <h3><code>stats.ctimeNs</code><span><a class="mark" href="#fs_stats_ctimens" id="fs_stats_ctimens">#</a></span></h3><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_ctimens.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.10.0</span>
  </div>
  <ul>
  <li><a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>Only present when <code>bigint: true</code> is passed into the method that generates
  the object.
  The timestamp indicating the last time the file status was changed expressed
  in nanoseconds since the POSIX Epoch.</p>
  <h3><code>stats.birthtimeNs</code><span><a class="mark" href="#fs_stats_birthtimens" id="fs_stats_birthtimens">#</a></span></h3><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_birthtimens.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.10.0</span>
  </div>
  <ul>
  <li><a href="/s/gJMq1y" target="_blank" rel="nofollow" class="type">&lt;bigint&gt;</a></li>
  </ul>
  <p>Only present when <code>bigint: true</code> is passed into the method that generates
  the object.
  The timestamp indicating the creation time of this file expressed in
  nanoseconds since the POSIX Epoch.</p>
  <h3><code>stats.atime</code><span><a class="mark" href="#fs_stats_atime" id="fs_stats_atime">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_atime.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_atime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.11.13</span>
  </div>
  <ul>
  <li><a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a> </li>
  </ul>
  <p>&#x8868;&#x660E;&#x4E0A;&#x6B21;&#x8BBF;&#x95EE;&#x6B64;&#x6587;&#x4EF6;&#x7684;&#x65F6;&#x95F4;&#x6233;&#x3002;</p>
  <h3><code>stats.mtime</code><span><a class="mark" href="#fs_stats_mtime" id="fs_stats_mtime">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_mtime.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_mtime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.11.13</span>
  </div>
  <ul>
  <li><a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a> </li>
  </ul>
  <p>&#x8868;&#x660E;&#x4E0A;&#x6B21;&#x4FEE;&#x6539;&#x6B64;&#x6587;&#x4EF6;&#x7684;&#x65F6;&#x95F4;&#x6233;&#x3002;</p>
  <h3><code>stats.ctime</code><span><a class="mark" href="#fs_stats_ctime" id="fs_stats_ctime">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_ctime.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_ctime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.11.13</span>
  </div>
  <ul>
  <li><a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a> </li>
  </ul>
  <p>&#x8868;&#x660E;&#x4E0A;&#x6B21;&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x72B6;&#x6001;&#x7684;&#x65F6;&#x95F4;&#x6233;&#x3002;</p>
  <h3><code>stats.birthtime</code><span><a class="mark" href="#fs_stats_birthtime" id="fs_stats_birthtime">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stats_birthtime.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stats_birthtime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.11.13</span>
  </div>
  <ul>
  <li><a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  </ul>
  <p>&#x8868;&#x793A;&#x6B64;&#x6587;&#x4EF6;&#x7684;&#x521B;&#x5EFA;&#x65F6;&#x95F4;&#x7684;&#x65F6;&#x95F4;&#x6233;&#x3002;</p>
  <h3>&#x6587;&#x4EF6;&#x5C5E;&#x6027;&#x7684;&#x65F6;&#x95F4;&#x503C;<span><a class="mark" href="#fs_stat_time_values" id="fs_stat_time_values">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/stat_time_values.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/stat_time_values.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p><code>atimeMs</code>&#x3001; <code>mtimeMs</code>&#x3001; <code>ctimeMs</code> &#x548C; <code>birthtimeMs</code> &#x5C5E;&#x6027;&#x662F;&#x4FDD;&#x5B58;&#x76F8;&#x5E94;&#x65F6;&#x95F4;&#xFF08;&#x4EE5;&#x6BEB;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#xFF09;&#x7684;<a href="/s/SXbo1v" rel="nofollow">&#x6570;&#x503C;</a>&#x3002;
  &#x5B83;&#x4EEC;&#x7684;&#x7CBE;&#x5EA6;&#x53D6;&#x51B3;&#x4E8E;&#x5E73;&#x53F0;&#x3002;
  &#x5F53;&#x5C06; <code>bigint: true</code> &#x4F20;&#x7ED9;&#x751F;&#x6210;&#x8BE5;&#x5BF9;&#x8C61;&#x7684;&#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x5C5E;&#x6027;&#x5C06;&#x4F1A;&#x662F; <a href="/s/3Jk6h6" rel="nofollow">bigint</a> &#x578B;&#xFF0C;&#x5426;&#x5219;&#x5B83;&#x4EEC;&#x5C06;&#x4F1A;&#x662F;<a href="/s/SXbo1v" rel="nofollow">&#x6570;&#x5B57;&#x578B;</a>&#x3002;</p>
  <p><code>atimeNs</code>&#x3001; <code>mtimeNs</code>&#x3001; <code>ctimeNs</code> &#x548C; <code>birthtimeNs</code> &#x5C5E;&#x6027;&#x662F;&#x4FDD;&#x5B58;&#x76F8;&#x5E94;&#x65F6;&#x95F4;&#xFF08;&#x4EE5;&#x7EB3;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#xFF09;&#x7684; <a href="/s/3Jk6h6" rel="nofollow">bigint</a>&#x3002;
  &#x4EC5;&#x5F53;&#x5C06; <code>bigint: true</code> &#x4F20;&#x7ED9;&#x751F;&#x6210;&#x8BE5;&#x5BF9;&#x8C61;&#x7684;&#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x5B83;&#x4EEC;&#x624D;&#x4F1A;&#x51FA;&#x73B0;&#x3002;
  &#x5B83;&#x4EEC;&#x7684;&#x7CBE;&#x5EA6;&#x53D6;&#x51B3;&#x4E8E;&#x5E73;&#x53F0;&#x3002;</p>
  <p><code>atime</code>&#x3001; <code>mtime</code>&#x3001; <code>ctime</code> &#x548C; <code>birthtime</code> &#x662F;&#x5BF9;&#x5E94;&#x65F6;&#x95F4;&#x7684; <a href="/s/A9TMoa" rel="nofollow"><code>Date</code></a> &#x5BF9;&#x8C61;&#x3002;
  <code>Date</code> &#x503C;&#x548C;&#x6570;&#x503C;&#x6CA1;&#x6709;&#x5173;&#x8054;&#x6027;&#x3002;
  &#x8D4B;&#x503C;&#x65B0;&#x7684;&#x6570;&#x503C;&#x3001;&#x6216;&#x8005;&#x6539;&#x53D8; <code>Date</code> &#x7684;&#x503C;&#xFF0C;&#x90FD;&#x5C06;&#x4E0D;&#x4F1A;&#x5F71;&#x54CD;&#x5230;&#x5BF9;&#x5E94;&#x7684;&#x5C5E;&#x6027;&#x3002;</p>
  <p>stat &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x65F6;&#x95F4;&#x5177;&#x6709;&#x4EE5;&#x4E0B;&#x8BED;&#x4E49;&#xFF1A;</p>
  <ul>
  <li><code>atime</code> &quot;&#x8BBF;&#x95EE;&#x65F6;&#x95F4;&quot; - &#x4E0A;&#x6B21;&#x8BBF;&#x95EE;&#x6587;&#x4EF6;&#x6570;&#x636E;&#x7684;&#x65F6;&#x95F4;&#x3002;&#x7531; <a href="/s/dC6BPb" rel="nofollow"><code>mknod(2)</code></a>&#x3001; <a href="/s/58Fxaj" rel="nofollow"><code>utimes(2)</code></a> &#x548C; <a href="/s/3BmXqe" rel="nofollow"><code>read(2)</code></a> &#x7CFB;&#x7EDF;&#x8C03;&#x7528;&#x66F4;&#x6539;&#x3002;</li>
  <li><code>mtime</code> &quot;&#x4FEE;&#x6539;&#x65F6;&#x95F4;&quot; - &#x4E0A;&#x6B21;&#x4FEE;&#x6539;&#x6587;&#x4EF6;&#x6570;&#x636E;&#x7684;&#x65F6;&#x95F4;&#x3002;&#x7531; <a href="/s/dC6BPb" rel="nofollow"><code>mknod(2)</code></a>&#x3001; <a href="/s/58Fxaj" rel="nofollow"><code>utimes(2)</code></a> &#x548C; <a href="/s/NmUvmK" rel="nofollow"><code>write(2)</code></a> &#x7CFB;&#x7EDF;&#x8C03;&#x7528;&#x66F4;&#x6539;&#x3002;</li>
  <li><code>ctime</code> &quot;&#x66F4;&#x6539;&#x65F6;&#x95F4;&quot; - &#x4E0A;&#x6B21;&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x72B6;&#x6001;&#xFF08;&#x4FEE;&#x6539;&#x7D22;&#x5F15;&#x8282;&#x70B9;&#x6570;&#x636E;&#xFF09;&#x7684;&#x65F6;&#x95F4;&#x3002;&#x7531; <a href="/s/K3psEw" rel="nofollow"><code>chmod(2)</code></a>&#x3001; <a href="/s/vSBegL" rel="nofollow"><code>chown(2)</code></a>&#x3001; <a href="/s/U8H1mr" rel="nofollow"><code>link(2)</code></a>&#x3001; <a href="/s/dC6BPb" rel="nofollow"><code>mknod(2)</code></a>&#x3001; <a href="/s/YbqghQ" rel="nofollow"><code>rename(2)</code></a>&#x3001; <a href="/s/gjRRsM" rel="nofollow"><code>unlink(2)</code></a>&#x3001; <a href="/s/58Fxaj" rel="nofollow"><code>utimes(2)</code></a>&#x3001; <a href="/s/3BmXqe" rel="nofollow"><code>read(2)</code></a> &#x548C; <a href="/s/NmUvmK" rel="nofollow"><code>write(2)</code></a> &#x7CFB;&#x7EDF;&#x8C03;&#x7528;&#x66F4;&#x6539;&#x3002;</li>
  <li><code>birthtime</code> &quot;&#x521B;&#x5EFA;&#x65F6;&#x95F4;&quot; - &#x521B;&#x5EFA;&#x6587;&#x4EF6;&#x7684;&#x65F6;&#x95F4;&#x3002;&#x5F53;&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#x65F6;&#x8BBE;&#x7F6E;&#x4E00;&#x6B21;&#x3002;
  &#x5728;&#x4E0D;&#x652F;&#x6301;&#x521B;&#x5EFA;&#x65F6;&#x95F4;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x8BE5;&#x5B57;&#x6BB5;&#x53EF;&#x80FD;&#x6539;&#x4E3A;&#x4FDD;&#x5B58; <code>ctime</code> &#x6216; <code>1970-01-01T00:00Z</code>&#xFF08;&#x5373; Unix &#x7EAA;&#x5143;&#x65F6;&#x95F4;&#x6233; <code>0</code>&#xFF09;&#x3002;
  &#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x8BE5;&#x503C;&#x53EF;&#x80FD;&#x5927;&#x4E8E; <code>atime</code> &#x6216; <code>mtime</code>&#x3002;
  &#x5728; Darwin &#x548C;&#x5176;&#x4ED6;&#x7684; FreeBSD &#x884D;&#x751F;&#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x4E5F;&#x53EF;&#x80FD;&#x4F7F;&#x7528; <a href="/s/58Fxaj" rel="nofollow"><code>utimes(2)</code></a> &#x7CFB;&#x7EDF;&#x8C03;&#x7528;&#x5C06; <code>atime</code> &#x663E;&#x5F0F;&#x5730;&#x8BBE;&#x7F6E;&#x4E3A;&#x6BD4; <code>birthtime</code> &#x66F4;&#x65E9;&#x7684;&#x503C;&#x3002;</li>
  </ul>
  <p>&#x5728; Node.js 0.12 &#x4E4B;&#x524D;&#xFF0C;&#x5728; Windows &#x7CFB;&#x7EDF;&#x4E0A; <code>ctime</code> &#x4FDD;&#x5B58; <code>birthtime</code>&#x3002;
  &#x4ECE; 0.12 &#x5F00;&#x59CB;&#xFF0C; <code>ctime</code> &#x4E0D;&#x518D;&#x662F;&#x201C;&#x521B;&#x5EFA;&#x65F6;&#x95F4;&#x201D;&#xFF0C;&#x800C;&#x5728; Unix &#x7CFB;&#x7EDF;&#x4E0A;&#x5219;&#x4ECE;&#x6765;&#x90FD;&#x4E0D;&#x662F;&#x3002;</p>
  <h2>fs.WriteStream &#x7C7B;<span><a class="mark" href="#fs_class_fs_writestream" id="fs_class_fs_writestream">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/class_fs_writestream.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/class_fs_writestream.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.93</span>
  </div>
  <ul>
  <li>&#x7EE7;&#x627F;&#x81EA; <a href="/s/9JUnJ8" target="_blank" rel="nofollow" class="type">&lt;stream.Writable&gt;</a></li>
  </ul>
  <p>&#x4F7F;&#x7528; <a href="/s/VdSJQa" rel="nofollow"><code>fs.createWriteStream()</code></a> &#x51FD;&#x6570;&#x521B;&#x5EFA;&#x5E76;&#x8FD4;&#x56DE;&#x7684; <code>fs.WriteStream</code> &#x5B9E;&#x4F8B;&#x3002;</p>
  <h3>&apos;close&apos; &#x4E8B;&#x4EF6;<span><a class="mark" href="#fs_event_close_2" id="fs_event_close_2">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/event_close_2.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/event_close_2.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.93</span>
  </div>
  <p>&#x5F53; <code>WriteStream</code> &#x7684;&#x5E95;&#x5C42;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x5DF2;&#x5173;&#x95ED;&#x65F6;&#x89E6;&#x53D1;&#x3002;</p>
  <h3>&apos;open&apos; &#x4E8B;&#x4EF6;<span><a class="mark" href="#fs_event_open_1" id="fs_event_open_1">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/event_open_1.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/event_open_1.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.93</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <code>WriteStream</code> &#x4F7F;&#x7528;&#x7684;&#x6574;&#x6570;&#x578B;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  </ul>
  <p>&#x5F53; <code>WriteStream</code> &#x7684;&#x6587;&#x4EF6;&#x6253;&#x5F00;&#x65F6;&#x89E6;&#x53D1;&#x3002;</p>
  <h3>&apos;ready&apos; &#x4E8B;&#x4EF6;<span><a class="mark" href="#fs_event_ready_1" id="fs_event_ready_1">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/event_ready_1.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/event_ready_1.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v9.11.0</span>
  </div>
  <p>&#x5F53; <code>fs.WriteStream</code> &#x51C6;&#x5907;&#x597D;&#x4F7F;&#x7528;&#x65F6;&#x89E6;&#x53D1;&#x3002;</p>
  <p><code>&apos;open&apos;</code> &#x4E8B;&#x4EF6;&#x4E4B;&#x540E;&#x7ACB;&#x5373;&#x89E6;&#x53D1;&#x3002;</p>
  <h3><code>writeStream.bytesWritten</code><span><a class="mark" href="#fs_writestream_byteswritten" id="fs_writestream_byteswritten">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/writestream_byteswritten.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/writestream_byteswritten.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.4.7</span>
  </div>
  <p>&#x5230;&#x76EE;&#x524D;&#x4E3A;&#x6B62;&#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;
  &#x4E0D;&#x5305;&#x62EC;&#x4ECD;&#x5728;&#x6392;&#x961F;&#x7B49;&#x5F85;&#x5199;&#x5165;&#x7684;&#x6570;&#x636E;&#x3002;</p>
  <h3><code>writeStream.path</code><span><a class="mark" href="#fs_writestream_path" id="fs_writestream_path">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/writestream_path.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/writestream_path.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.93</span>
  </div>
  <p>&#x6D41;&#x6B63;&#x5728;&#x5199;&#x5165;&#x7684;&#x6587;&#x4EF6;&#x7684;&#x8DEF;&#x5F84;&#xFF0C;&#x7531; <a href="/s/VdSJQa" rel="nofollow"><code>fs.createWriteStream()</code></a> &#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x6307;&#x5B9A;&#x3002;
  &#x5982;&#x679C; <code>path</code> &#x4F20;&#x5165;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219; <code>writeStream.path</code> &#x5C06;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x3002;
  &#x5982;&#x679C; <code>path</code> &#x4F20;&#x5165; <code>Buffer</code>&#xFF0C;&#x5219; <code>writeStream.path</code> &#x5C06;&#x662F; <code>Buffer</code>&#x3002;</p>
  <h3><code>writeStream.pending</code><span><a class="mark" href="#fs_writestream_pending" id="fs_writestream_pending">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/writestream_pending.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/writestream_pending.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v11.2.0</span>
  </div>
  <ul>
  <li><a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C;&#x5E95;&#x5C42;&#x7684;&#x6587;&#x4EF6;&#x8FD8;&#x672A;&#x88AB;&#x6253;&#x5F00;&#xFF08;&#x5373;&#x5728;&#x89E6;&#x53D1; <code>&apos;ready&apos;</code> &#x4E8B;&#x4EF6;&#x4E4B;&#x524D;&#xFF09;&#xFF0C;&#x5219;&#x6B64;&#x5C5E;&#x6027;&#x4E3A; <code>true</code>&#x3002;</p>
  <h2><code>fs.access(path[, mode], callback)</code><span><a class="mark" href="#fs_fs_access_path_mode_callback" id="fs_fs_access_path_mode_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_access_path_mode_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_access_path_mode_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v6.3.0</td>
  <td><p>&#x76F4;&#x63A5;&#x5B58;&#x5728;&#x4E8E; <code>fs</code> &#x4E0A;&#x7684;&#x5E38;&#x6570;&#xFF08;&#x5982; <code>fs.R_OK</code> &#x7B49;&#xFF09;&#x5DF2;&#x88AB;&#x79FB;&#x5230; <code>fs.constants</code>&#xFF08;&#x8F6F;&#x5F03;&#x7528;&#xFF09;&#x3002; &#x56E0;&#x6B64;&#xFF0C;&#x5BF9;&#x4E8E; Node.js <code>&lt; v6.3.0</code>&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>fs</code> &#x8BBF;&#x95EE;&#x8FD9;&#x4E9B;&#x5E38;&#x91CF;&#xFF0C;&#x6216;&#x7C7B;&#x4F3C; <code>(fs.constants || fs).R_OK</code> &#x7684;&#x5904;&#x7406;&#x4EE5;&#x517C;&#x5BB9;&#x6240;&#x6709;&#x7248;&#x672C;&#x3002;</p></td></tr>
  <tr><td>v0.11.15</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.11.15</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>fs.constants.F_OK</code>&#x3002;</li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x6D4B;&#x8BD5;&#x7528;&#x6237;&#x5BF9; <code>path</code> &#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x6216;&#x76EE;&#x5F55;&#x7684;&#x6743;&#x9650;&#x3002;
  <code>mode</code> &#x53C2;&#x6570;&#x662F;&#x4E00;&#x4E2A;&#x53EF;&#x9009;&#x7684;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x8981;&#x6267;&#x884C;&#x7684;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x68C0;&#x67E5;&#x3002;
  &#x67E5;&#x770B;<a href="/s/qZfpqk" rel="nofollow">&#x6587;&#x4EF6;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x7684;&#x5E38;&#x91CF;</a>&#x4E86;&#x89E3; <code>mode</code> &#x7684;&#x53EF;&#x9009;&#x503C;&#x3002;
  &#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x7531;&#x4E24;&#x4E2A;&#x6216;&#x66F4;&#x591A;&#x4E2A;&#x503C;&#x6309;&#x4F4D;&#x6216;&#x7EC4;&#x6210;&#x7684;&#x63A9;&#x7801;&#xFF08;&#x4F8B;&#x5982; <code>fs.constants.W_OK | fs.constants.R_OK</code>&#xFF09;&#x3002;</p>
  <p>&#x6700;&#x5#x540E;&#x4E00;&#x4E2A;&#x53C2;&#x6570; <code>callback</code> &#x662F;&#x56DE;&#x8C03;&#x51FD;&#x6570;&#xFF0C;&#x8C03;&#x7528;&#x65F6;&#x4F1A;&#x4F20;&#x5165;&#x53EF;&#x80FD;&#x7684;&#x9519;&#x8BEF;&#x53C2;&#x6570;&#x3002;
  &#x5982;&#x679C;&#x4EFB;&#x4F55;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x68C0;&#x67E5;&#x5931;&#x8D25;&#xFF0C;&#x5219;&#x9519;&#x8BEF;&#x53C2;&#x6570;&#x4F1A;&#x662F; <code>Error</code> &#x5BF9;&#x8C61;&#x3002;
  &#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#x4F1A;&#x68C0;&#x67E5; <code>package.json</code> &#x662F;&#x5426;&#x5B58;&#x5728;&#x3001;&#x4EE5;&#x53CA;&#x662F;&#x5426;&#x53EF;&#x8BFB;&#x6216;&#x53EF;&#x5199;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> file = <span class="hljs-string">&apos;package.json&apos;</span>;
  
  <span class="hljs-comment">// &#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x5B58;&#x5728;&#x4E8E;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x4E2D;&#x3002;</span>
  fs.access(file, fs.constants.F_OK, (err) =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${file}</span> <span class="hljs-subst">${err ? <span class="hljs-string">&apos;&#x4E0D;&#x5B58;&#x5728;&apos;</span> : <span class="hljs-string">&apos;&#x5B58;&#x5728;&apos;</span>}</span>`</span>);
  });
  
  <span class="hljs-comment">// &#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x53EF;&#x8BFB;&#x3002;</span>
  fs.access(file, fs.constants.R_OK, (err) =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${file}</span> <span class="hljs-subst">${err ? <span class="hljs-string">&apos;&#x4E0D;&#x53EF;&#x8BFB;&apos;</span> : <span class="hljs-string">&apos;&#x53EF;&#x8BFB;&apos;</span>}</span>`</span>);
  });
  
  <span class="hljs-comment">// &#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x53EF;&#x5199;&#x3002;</span>
  fs.access(file, fs.constants.W_OK, (err) =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${file}</span> <span class="hljs-subst">${err ? <span class="hljs-string">&apos;&#x4E0D;&#x53EF;&#x5199;&apos;</span> : <span class="hljs-string">&apos;&#x53EF;&#x5199;&apos;</span>}</span>`</span>);
  });
  
  <span class="hljs-comment">// &#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x5B58;&#x5728;&#x4E8E;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x4E2D;&#x3001;&#x4EE5;&#x53CA;&#x662F;&#x5426;&#x53EF;&#x5199;&#x3002;</span>
  fs.access(file, fs.constants.F_OK | fs.constants.W_OK, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) {
      <span class="hljs-built_in">console</span>.error(
        <span class="hljs-string">`<span class="hljs-subst">${file}</span> <span class="hljs-subst">${err.code === <span class="hljs-string">&apos;ENOENT&apos;</span> ? <span class="hljs-string">&apos;&#x4E0D;&#x5B58;&#x5728;&apos;</span> : <span class="hljs-string">&apos;&#x53EA;&#x53EF;&#x8BFB;&apos;</span>}</span>`</span>);
    } <span class="hljs-keyword">else</span> {
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${file}</span> &#x5B58;&#x5728;&#xFF0C;&#x4E14;&#x53EF;&#x5199;`</span>);
    }
  });</code></pre>
  <p>&#x4E0D;&#x8981;&#x5728;&#x8C03;&#x7528; <code>fs.open()</code>&#x3001; <code>fs.readFile()</code> &#x6216; <code>fs.writeFile()</code> &#x4E4B;&#x524D;&#x4F7F;&#x7528; <code>fs.access()</code> &#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x7684;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x3002;
  &#x8FD9;&#x6837;&#x505A;&#x4F1A;&#x5F15;&#x5165;&#x7ADE;&#x6001;&#x6761;&#x4EF6;&#xFF0C;&#x56E0;&#x4E3A;&#x5176;&#x4ED6;&#x8FDB;&#x7A0B;&#x53EF;&#x80FD;&#x4F1A;&#x5728;&#x4E24;&#x4E2A;&#x8C03;&#x7528;&#x4E4B;&#x95F4;&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x72B6;&#x6001;&#x3002;
  &#x800C;&#x662F;&#xFF0C;&#x5E94;&#x8BE5;&#x76F4;&#x63A5;&#x6253;&#x5F00;&#x3001;&#x8BFB;&#x53D6;&#x6216;&#x5199;&#x5165;&#x6587;&#x4EF6;&#xFF0C;&#x5E76;&#x4E14;&#x5F53;&#x6587;&#x4EF6;&#x65E0;&#x6CD5;&#x8BBF;&#x95EE;&#x65F6;&#x5904;&#x7406;&#x5F15;&#x53D1;&#x7684;&#x9519;&#x8BEF;&#x3002;</p>
  <p><strong>&#x5199;&#x5165;&#xFF08;&#x4E0D;&#x63A8;&#x8350;&#xFF09;</strong></p>
  <pre><code class="language-js">fs.access(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>, (err) =&gt; {
    <span class="hljs-keyword">if</span> (!err) {
      <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&#x5DF2;&#x5B58;&#x5728;&apos;</span>);
      <span class="hljs-keyword">return</span>;
    }
  
    fs.open(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>, <span class="hljs-string">&apos;wx&apos;</span>, (err, fd) =&gt; {
      <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
      writeMyData(fd);
    });
  });</code></pre>
  <p><strong>&#x5199;&#x5165;&#xFF08;&#x63A8;&#x8350;&#xFF09;</strong></p>
  <pre><code class="language-js">fs.open(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>, <span class="hljs-string">&apos;wx&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-keyword">if</span> (err) {
      <span class="hljs-keyword">if</span> (err.code === <span class="hljs-string">&apos;EEXIST&apos;</span>) {
        <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&#x5DF2;&#x5B58;&#x5728;&apos;</span>);
        <span class="hljs-keyword">return</span>;
      }
  
      <span class="hljs-keyword">throw</span> err;
    }
  
    writeMyData(fd);
  });</code></pre>
  <p><strong>&#x8BFB;&#x53D6;&#xFF08;&#x4E0D;&#x63A8;&#x8350;&#xFF09;</strong></p>
  <pre><code class="language-js">fs.access(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) {
      <span class="hljs-keyword">if</span> (err.code === <span class="hljs-string">&apos;ENOENT&apos;</span>) {
        <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&apos;</span>);
        <span class="hljs-keyword">return</span>;
      }
  
      <span class="hljs-keyword">throw</span> err;
    }
  
    fs.open(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>, <span class="hljs-string">&apos;r&apos;</span>, (err, fd) =&gt; {
      <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
      readMyData(fd);
    });
  });</code></pre>
  <p><strong>&#x8BFB;&#x53D6;&#xFF08;&#x63A8;&#x8350;&#xFF09;</strong></p>
  <pre><code class="language-js">fs.open(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>, <span class="hljs-string">&apos;r&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-keyword">if</span> (err) {
      <span class="hljs-keyword">if</span> (err.code === <span class="hljs-string">&apos;ENOENT&apos;</span>) {
        <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&apos;</span>);
        <span class="hljs-keyword">return</span>;
      }
  
      <span class="hljs-keyword">throw</span> err;
    }
  
    readMyData(fd);
  });</code></pre>
  <p>&#x4E0A;&#x9762;&#x7684;&#x201C;&#x4E0D;&#x63A8;&#x8350;&#x201D;&#x793A;&#x4F8B;&#x4F1A;&#x5148;&#x68C0;&#x67E5;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x4F7F;&#x7528;&#x6587;&#x4EF6;&#x3002;
  &#x201C;&#x63A8;&#x8350;&#x201D;&#x793A;&#x4F8B;&#x5219;&#x66F4;&#x597D;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x4EEC;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x6587;&#x4EF6;&#x5E76;&#x5904;&#x7406;&#x9519;&#x8BEF;&#xFF08;&#x5982;&#x679C;&#x6709;&#x9519;&#x8BEF;&#x7684;&#x8BDD;&#xFF09;&#x3002;</p>
  <p>&#x901A;&#x5E38;&#xFF0C;&#x4EC5;&#x5728;&#x4E0D;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x6587;&#x4EF6;&#x65F6;&#xFF08;&#x4F8B;&#x5982;&#x5F53;&#x5176;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x662F;&#x6765;&#x81EA;&#x5176;&#x4ED6;&#x8FDB;&#x7A0B;&#x7684;&#x4FE1;&#x53F7;&#x65F6;&#xFF09;&#xFF0C;&#x624D;&#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x7684;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x3002;</p>
  <p>&#x5728; Windows &#x4E0A;&#xFF0C;&#x76EE;&#x5F55;&#x4E0A;&#x7684;&#x8BBF;&#x95EE;&#x63A7;&#x5236;&#x7B56;&#x7565;&#xFF08;ACL&#xFF09;&#x53EF;&#x80FD;&#x4F1A;&#x9650;&#x5236;&#x5BF9;&#x6587;&#x4EF6;&#x6216;&#x76EE;&#x5F55;&#x7684;&#x8BBF;&#x95EE;&#x3002;
  &#x4F46;&#x662F;&#xFF0C; <code>fs.access()</code> &#x51FD;&#x6570;&#x4E0D;&#x68C0;&#x67E5; ACL&#xFF0C;&#x56E0;&#x6B64;&#x5373;&#x4F7F; ACL &#x9650;&#x5236;&#x7528;&#x6237;&#x8BFB;&#x53D6;&#x6216;&#x5199;&#x5165;&#xFF0C;&#x4E5F;&#x53EF;&#x80FD;&#x62A5;&#x544A;&#x8DEF;&#x5F84;&#x662F;&#x53EF;&#x8BBF;&#x95EE;&#x7684;&#x3002;</p>
  <h2><code>fs.accessSync(path[, mode])</code><span><a class="mark" href="#fs_fs_accesssync_path_mode" id="fs_fs_accesssync_path_mode">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_accesssync_path_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_accesssync_path_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.11.15</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.11.15</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>fs.constants.F_OK</code>&#x3002;</li>
  </ul>
  <p>&#x540C;&#x6B65;&#x5730;&#x6D4B;&#x8BD5;&#x7528;&#x6237;&#x5BF9; <code>path</code> &#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x6216;&#x76EE;&#x5F55;&#x7684;&#x6743;&#x9650;&#x3002;
  <code>mode</code> &#x53C2;&#x6570;&#x662F;&#x4E00;&#x4E2A;&#x53EF;&#x9009;&#x7684;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x8981;&#x6267;&#x884C;&#x7684;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x68C0;&#x67E5;&#x3002;
  &#x67E5;&#x770B;<a href="/s/qZfpqk" rel="nofollow">&#x6587;&#x4EF6;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x7684;&#x5E38;&#x91CF;</a>&#x4E86;&#x89E3; <code>mode</code> &#x7684;&#x53EF;&#x9009;&#x503C;&#x3002;
  &#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x7531;&#x4E24;&#x4E2A;&#x6216;&#x66F4;&#x591A;&#x4E2A;&#x503C;&#x6309;&#x4F4D;&#x6216;&#x7EC4;&#x6210;&#x7684;&#x63A9;&#x7801;&#xFF08;&#x4F8B;&#x5982; <code>fs.constants.W_OK | fs.constants.R_OK</code>&#xFF09;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x68C0;&#x67E5;&#x5931;&#x8D25;&#xFF0C;&#x5219;&#x629B;&#x51FA; <code>Error</code>&#x3002;
  &#x5426;&#x5219;&#xFF0C;&#x8BE5;&#x65B9;&#x6CD5;&#x5C06;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">try</span> {
    fs.accessSync(<span class="hljs-string">&apos;etc/passwd&apos;</span>, fs.constants.R_OK | fs.constants.W_OK);
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x53EF;&#x4EE5;&#x8BFB;&#x5199;&apos;</span>);
  } <span class="hljs-keyword">catch</span> (err) {
    <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;&#x65E0;&#x6743;&#x8BBF;&#x95EE;&apos;</span>);
  }</code></pre>
  <h2><code>fs.appendFile(path, data[, options], callback)</code><span><a class="mark" href="#fs_fs_appendfile_path_data_options_callback" id="fs_fs_appendfile_path_data_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_appendfile_path_data_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_appendfile_path_data_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x4F20;&#x5165;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#x65E0;&#x6CD5;&#x518D;&#x88AB;&#x4FEE;&#x6539;&#x3002;</p></td></tr>
  <tr><td>v5.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>file</code> &#x53EF;&#x4EE5;&#x662F;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</p></td></tr>
  <tr><td>v0.6.7</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.6.7</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x6587;&#x4EF6;&#x540D;&#x6216;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  <li><code>data</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#x3002;</li>
  <li><code>flag</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;a&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x8FFD;&#x52A0;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5C1A;&#x4E0D;&#x5B58;&#x5728;&#x5219;&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#x3002;
  <code>data</code> &#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x6216; <a href="/s/FApxjh" rel="nofollow"><code>Buffer</code></a>&#x3002;</p>
  <pre><code class="language-js">fs.appendFile(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x8FFD;&#x52A0;&#x7684;&#x6570;&#x636E;&apos;</span>, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6570;&#x636E;&#x5DF2;&#x88AB;&#x8FFD;&#x52A0;&#x5230;&#x6587;&#x4EF6;&apos;</span>);
  });</code></pre>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF1A;</p>
  <pre><code class="language-js">fs.appendFile(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x8FFD;&#x52A0;&#x7684;&#x6570;&#x636E;&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>, callback);</code></pre>
  <p><code>path</code> &#x53EF;&#x4EE5;&#x6307;&#x5B9A;&#x4E3A;&#x5DF2;&#x6253;&#x5F00;&#x7528;&#x4E8E;&#x8FFD;&#x52A0;&#xFF08;&#x4F7F;&#x7528; <code>fs.open()</code> &#x6216; <code>fs.openSync()</code>&#xFF09;&#x7684;&#x6570;&#x5B57;&#x578B;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;
  &#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x4E0D;&#x4F1A;&#x81EA;&#x52A8;&#x5173;&#x95ED;&#x3002;</p>
  <pre><code class="language-js">fs.open(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    fs.appendFile(fd, <span class="hljs-string">&apos;&#x8FFD;&#x52A0;&#x7684;&#x6570;&#x636E;&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>, (err) =&gt; {
      fs.close(fd, (err) =&gt; {
        <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
      });
      <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    });
  });</code></pre>
  <h2><code>fs.appendFileSync(path, data[, options])</code><span><a class="mark" href="#fs_fs_appendfilesync_path_data_options" id="fs_fs_appendfilesync_path_data_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_appendfilesync_path_data_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_appendfilesync_path_data_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x4F20;&#x5165;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#x65E0;&#x6CD5;&#x518D;&#x88AB;&#x4FEE;&#x6539;&#x3002;</p></td></tr>
  <tr><td>v5.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>file</code> &#x53EF;&#x4EE5;&#x662F;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</p></td></tr>
  <tr><td>v0.6.7</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.6.7</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x6587;&#x4EF6;&#x540D;&#x6216;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  <li><code>data</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#x3002;</li>
  <li><code>flag</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;a&apos;</code>&#x3002;</li>
  </ul>
  </li>
  </ul>
  <p>&#x540C;&#x6B65;&#x5730;&#x5C06;&#x6570;&#x636E;&#x8FFD;&#x52A0;&#x5230;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5C1A;&#x4E0D;&#x5B58;&#x5728;&#x5219;&#x521B;&#x5EFA;&#x8BE5;&#x6587;&#x4EF6;&#x3002;
  <code>data</code> &#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x6216; <a href="/s/FApxjh" rel="nofollow"><code>Buffer</code></a>&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">try</span> {
    fs.appendFileSync(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x8FFD;&#x52A0;&#x7684;&#x6570;&#x636E;&apos;</span>);
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6570;&#x636E;&#x5DF2;&#x88AB;&#x8FFD;&#x52A0;&#x5230;&#x6587;&#x4EF6;&apos;</span>);
  } <span class="hljs-keyword">catch</span> (err) {
    <span class="hljs-comment">/* &#x5904;&#x7406;&#x9519;&#x8BEF; */</span>
  }</code></pre>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF1A;</p>
  <pre><code class="language-js">fs.appendFileSync(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x8FFD;&#x52A0;&#x7684;&#x6570;&#x636E;&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>);</code></pre>
  <p><code>path</code> &#x53EF;&#x4EE5;&#x6307;&#x5B9A;&#x4E3A;&#x5DF2;&#x6253;&#x5F00;&#x7528;&#x4E8E;&#x8FFD;&#x52A0;&#xFF08;&#x4F7F;&#x7528; <code>fs.open()</code> &#x6216; <code>fs.openSync()</code>&#xFF09;&#x7684;&#x6570;&#x5B57;&#x578B;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;
  &#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x4E0D;&#x4F1A;&#x81EA;&#x52A8;&#x5173;&#x95ED;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">let</span> fd;
  
  <span class="hljs-keyword">try</span> {
    fd = fs.openSync(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;a&apos;</span>);
    fs.appendFileSync(fd, <span class="hljs-string">&apos;&#x8FFD;&#x52A0;&#x7684;&#x6570;&#x636E;&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>);
  } <span class="hljs-keyword">catch</span> (err) {
    <span class="hljs-comment">/* &#x5904;&#x7406;&#x9519;&#x8BEF; */</span>
  } <span class="hljs-keyword">finally</span> {
    <span class="hljs-keyword">if</span> (fd !== <span class="hljs-literal">undefined</span>)
      fs.closeSync(fd);
  }</code></pre>
  <h2><code>fs.chmod(path, mode, callback)</code><span><a class="mark" href="#fs_fs_chmod_path_mode_callback" id="fs_fs_chmod_path_mode_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_chmod_path_mode_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_chmod_path_mode_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.1.30</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.30</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x6743;&#x9650;&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x4E5F;&#x53EF;&#x53C2;&#x89C1; <a href="/s/K3psEw" rel="nofollow"><code>chmod(2)</code></a>&#x3002;</p>
  <pre><code class="language-js">fs.chmod(<span class="hljs-string">&apos;my_file.txt&apos;</span>, <span class="hljs-number">0o775</span>, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6587;&#x4EF6; &#x201C;my_file.txt&#x201D; &#x7684;&#x6743;&#x9650;&#x5DF2;&#x88AB;&#x66F4;&#x6539;&apos;</span>);
  });</code></pre>
  <h3>&#x6587;&#x4EF6;&#x7684;&#x6A21;&#x5F0F;<span><a class="mark" href="#fs_file_modes" id="fs_file_modes">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/file_modes.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_modes.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p><code>fs.chmod()</code> &#x548C; <code>fs.chmodSync()</code> &#x65B9;&#x6CD5;&#x4E2D;&#x4F7F;&#x7528;&#x7684; <code>mode</code> &#x53C2;&#x6570;&#x662F;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x5E38;&#x91CF;&#x7684;&#x903B;&#x8F91;&#x6216;&#x8FD0;&#x7B97;&#x521B;&#x5EFA;&#x7684;&#x6570;&#x5B57;&#x578B;&#x4F4D;&#x63A9;&#x7801;&#xFF1A;</p>
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  <table><thead><tr><th>&#x5E38;&#x91CF;</th><th>&#x516B;&#x8FDB;&#x5236;&#x503C;</th><th>&#x8BF4;&#x660E;</th></tr></thead><tbody><tr><td><code>fs.constants.S_IRUSR</code></td><td><code>0o400</code></td><td>&#x6240;&#x6709;&#x8005;&#x53EF;&#x8BFB;</td></tr><tr><td><code>fs.constants.S_IWUSR</code></td><td><code>0o200</code></td><td>&#x6240;&#x6709;&#x8005;&#x53EF;&#x5199;</td></tr><tr><td><code>fs.constants.S_IXUSR</code></td><td><code>0o100</code></td><td>&#x6240;&#x6709;&#x8005;&#x53EF;&#x6267;&#x884C;&#x6216;&#x641C;&#x7D22;</td></tr><tr><td><code>fs.constants.S_IRGRP</code></td><td><code>0o40</code></td><td>&#x7FA4;&#x7EC4;&#x53EF;&#x8BFB;</td></tr><tr><td><code>fs.constants.S_IWGRP</code></td><td><code>0o20</code></td><td>&#x7FA4;&#x7EC4;&#x53EF;&#x5199;</td></tr><tr><td><code>fs.constants.S_IXGRP</code></td><td><code>0o10</code></td><td>&#x7FA4;&#x7EC4;&#x53EF;&#x6267;&#x884C;&#x6216;&#x641C;&#x7D22;</td></tr><tr><td><code>fs.constants.S_IROTH</code></td><td><code>0o4</code></td><td>&#x5176;&#x4ED6;&#x4EBA;&#x53EF;&#x8BFB;</td></tr><tr><td><code>fs.constants.S_IWOTH</code></td><td><code>0o2</code></td><td>&#x5176;&#x4ED6;&#x4EBA;&#x53EF;&#x5199;</td></tr><tr><td><code>fs.constants.S_IXOTH</code></td><td><code>0o1</code></td><td>&#x5176;&#x4ED6;&#x4EBA;&#x53EF;&#x6267;&#x884C;&#x6216;&#x641C;&#x7D22;</td></tr></tbody></table>
  <p>&#x6784;&#x9020; <code>mode</code> &#x66F4;&#x7B80;&#x5355;&#x7684;&#x65B9;&#x6CD5;&#x662F;&#x4F7F;&#x7528;&#x4E09;&#x4E2A;&#x516B;&#x8FDB;&#x5236;&#x6570;&#x5B57;&#x7684;&#x5E8F;&#x5217;&#xFF08; &#x4F8B;&#x5982; <code>765</code>&#xFF09;&#x3002;
  &#x6700;&#x5DE6;&#x8FB9;&#x7684;&#x6570;&#x5B57;&#xFF08;&#x793A;&#x4F8B;&#x4E2D;&#x7684; <code>7</code>&#xFF09;&#x6307;&#x5B9A;&#x6587;&#x4EF6;&#x6240;&#x6709;&#x8005;&#x7684;&#x6743;&#x9650;&#x3002;
  &#x4E2D;&#x95F4;&#x7684;&#x6570;&#x5B57;&#xFF08;&#x793A;&#x4F8B;&#x4E2D;&#x7684; <code>6</code>&#xFF09;&#x6307;&#x5B9A;&#x7FA4;&#x7EC4;&#x7684;&#x6743;&#x9650;&#x3002;
  &#x6700;&#x53F3;&#x8FB9;&#x7684;&#x6570;&#x5B57;&#xFF08;&#x793A;&#x4F8B;&#x4E2D;&#x7684; <code>5</code>&#xFF09;&#x6307;&#x5B9A;&#x5176;&#x4ED6;&#x4EBA;&#x7684;&#x6743;&#x9650;&#x3002;</p>
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  <table><thead><tr><th>&#x6570;&#x5B57;</th><th>&#x8BF4;&#x660E;</th></tr></thead><tbody><tr><td><code>7</code></td><td>&#x53EF;&#x8BFB;&#x3001;&#x53EF;&#x5199;&#x3001;&#x53EF;&#x6267;&#x884C;</td></tr><tr><td><code>6</code></td><td>&#x53EF;&#x8BFB;&#x3001;&#x53EF;&#x5199;</td></tr><tr><td><code>5</code></td><td>&#x53EF;&#x8BFB;&#x3001;&#x53EF;&#x6267;&#x884C;</td></tr><tr><td><code>4</code></td><td>&#x53EA;&#x8BFB;</td></tr><tr><td><code>3</code></td><td>&#x53EF;&#x5199;&#x3001;&#x53EF;&#x6267;&#x884C;</td></tr><tr><td><code>2</code></td><td>&#x53EA;&#x5199;</td></tr><tr><td><code>1</code></td><td>&#x53EA;&#x53EF;&#x6267;&#x884C;</td></tr><tr><td><code>0</code></td><td>&#x6CA1;&#x6709;&#x6743;&#x9650;</td></tr></tbody></table>
  <p>&#x4F8B;&#x5982;&#xFF0C;&#x516B;&#x8FDB;&#x5236;&#x503C; <code>0o765</code> &#x8868;&#x793A;&#xFF1A;</p>
  <ul>
  <li>&#x6240;&#x6709;&#x8005;&#x53EF;&#x4EE5;&#x8BFB;&#x53D6;&#x3001;&#x5199;&#x5165;&#x548C;&#x6267;&#x884C;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</li>
  <li>&#x7FA4;&#x7EC4;&#x53EF;&#x4EE5;&#x8BFB;&#x548C;&#x5199;&#x5165;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</li>
  <li>&#x5176;&#x4ED6;&#x4EBA;&#x53EF;&#x4EE5;&#x8BFB;&#x53D6;&#x548C;&#x6267;&#x884C;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</li>
  </ul>
  <p>&#x5F53;&#x4F7F;&#x7528;&#x671F;&#x671B;&#x7684;&#x6587;&#x4EF6;&#x6A21;&#x5F0F;&#x7684;&#x539F;&#x59CB;&#x6570;&#x5B57;&#x65F6;&#xFF0C;&#x4EFB;&#x4F55;&#x5927;&#x4E8E; <code>0o777</code> &#x7684;&#x503C;&#x90FD;&#x53EF;&#x80FD;&#x5BFC;&#x81F4;&#x4E0D;&#x652F;&#x6301;&#x4E00;&#x81F4;&#x7684;&#x7279;&#x5B9A;&#x4E8E;&#x5E73;&#x53F0;&#x7684;&#x884C;&#x4E3A;&#x3002;
  &#x56E0;&#x6B64;&#xFF0C;&#x8BF8;&#x5982; <code>S_ISVTX</code>&#x3001; <code>S_ISGID</code> &#x6216; <code>S_ISUID</code> &#x4E4B;&#x7C7B;&#x7684;&#x5E38;&#x91CF;&#x4E0D;&#x4F1A;&#x5728; <code>fs.constants</code> &#x4E2D;&#x516C;&#x5F00;&#x3002;</p>
  <p>&#x6CE8;&#x610F;&#x4E8B;&#x9879;&#xFF1A;&#x5728; Windows &#x4E0A;&#xFF0C;&#x53EA;&#x80FD;&#x66F4;&#x6539;&#x5199;&#x5165;&#x6743;&#x9650;&#xFF0C;&#x5E76;&#x4E14;&#x4E0D;&#x4F1A;&#x5B9E;&#x73B0;&#x7FA4;&#x7EC4;&#x3001;&#x6240;&#x6709;&#x8005;&#x6216;&#x5176;&#x4ED6;&#x4EBA;&#x7684;&#x6743;&#x9650;&#x4E4B;&#x95F4;&#x7684;&#x533A;&#x522B;&#x3002;</p>
  <h2><code>fs.chmodSync(path, mode)</code><span><a class="mark" href="#fs_fs_chmodsync_path_mode" id="fs_fs_chmodsync_path_mode">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_chmodsync_path_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_chmodsync_path_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.6.7</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.6.7</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F0#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/6QUJs8" rel="nofollow"><code>fs.chmod()</code></a>&#x3002;</p>
  <p>&#x4E5F;&#x53EF;&#x53C2;&#x89C1; <a href="/s/K3psEw" rel="nofollow"><code>chmod(2)</code></a>&#x3002;</p>
  <h2><code>fs.chown(path, uid, gid, callback)</code><span><a class="mark" href="#fs_fs_chown_path_uid_gid_callback" id="fs_fs_chown_path_uid_gid_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_chown_path_uid_gid_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_chown_path_uid_gid_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.1.97</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.97</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>uid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>gid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x6240;&#x6709;&#x8005;&#x548C;&#x7FA4;&#x7EC4;&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x4E5F;&#x53EF;&#x53C2;&#x89C1; <a href="/s/vSBegL" rel="nofollow"><code>chown(2)</code></a>&#x3002;</p>
  <h2><code>fs.chownSync(path, uid, gid)</code><span><a class="mark" href="#fs_fs_chownsync_path_uid_gid" id="fs_fs_chownsync_path_uid_gid">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_chownsync_path_uid_gid.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_chownsync_path_uid_gid.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.97</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.97</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>uid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>gid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x5730;&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x6240;&#x6709;&#x8005;&#x548C;&#x7FA4;&#x7EC4;&#x3002;
  &#x8FD4;&#x56DE; <code>undefined</code>&#x3002;
  &#x8FD9;&#x662F; <a href="/s/WXjM7j" rel="nofollow"><code>fs.chown()</code></a> &#x7684;&#x540C;&#x6B65;&#x7248;&#x672C;&#x3002;</p>
  <p>&#x4E5F;&#x53EF;&#x53C2;&#x89C1; <a href="/s/vSBegL" rel="nofollow"><code>chown(2)</code></a>&#x3002;</p>
  <h2><code>fs.close(fd, callback)</code><span><a class="mark" href="#fs_fs_close_fd_callback" id="fs_fs_close_fd_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_close_fd_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_close_fd_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.0.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.0.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/vCJCMG" rel="nofollow"><code>close(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x901A;&#x8FC7;&#x4EFB;&#x4F55;&#x5176;&#x4ED6; <code>fs</code> &#x64CD;&#x4F5C;&#x5728;&#x5F53;&#x524D;&#x6B63;&#x5728;&#x4F7F;&#x7528;&#x7684;&#x4EFB;&#x4F55;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#xFF08;<code>fd</code>&#xFF09;&#x4E0A;&#x8C03;&#x7528; <code>fs.close()</code> &#x53EF;&#x80FD;&#x5BFC;&#x81F4;&#x672A;&#x5B9A;&#x4E49;&#x7684;&#x884C;&#x4E3A;&#x3002;</p>
  <h2><code>fs.closeSync(fd)</code><span><a class="mark" href="#fs_fs_closesync_fd" id="fs_fs_closesync_fd">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_closesync_fd.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_closesync_fd.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/vCJCMG" rel="nofollow"><code>close(2)</code></a>&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <p>&#x901A;&#x8FC7;&#x4EFB;&#x4F55;&#x5176;&#x4ED6; <code>fs</code> &#x64CD;&#x4F5C;&#x5728;&#x5F53;&#x524D;&#x6B63;&#x5728;&#x4F7F;&#x7528;&#x7684;&#x4EFB;&#x4F55;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#xFF08;<code>fd</code>&#xFF09;&#x4E0A;&#x8C03;&#x7528; <code>fs.closeSync()</code> &#x53EF;&#x80FD;&#x5BFC;&#x81F4;&#x672A;&#x5B9A;&#x4E49;&#x7684;&#x884C;&#x4E3A;&#x3002;</p>
  <h2><code>fs.constants</code><span><a class="mark" href="#fs_fs_constants" id="fs_fs_constants">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_constants.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_constants.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ul>
  <li><a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></li>
  </ul>
  <p>&#x8FD4;&#x56DE;&#x5305;&#x542B;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x64CD;&#x4F5C;&#x5E38;&#x7528;&#x5E38;&#x91CF;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5F53;&#x524D;&#x5B9A;&#x4E49;&#x7684;&#x7279;&#x5B9A;&#x5E38;&#x91CF;&#x5728; <a href="/s/4UdXHr" rel="nofollow">FS &#x5E38;&#x91CF;</a>&#x4E2D;&#x63CF;&#x8FF0;&#x3002;</p>
  <h2><code>fs.copyFile(src, dest[, mode], callback)</code><span><a class="mark" href="#fs_fs_copyfile_src_dest_mode_callback" id="fs_fs_copyfile_src_dest_mode_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_copyfile_src_dest_mode_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_copyfile_src_dest_mode_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v8.5.0</span>
  </div>
  <ul>
  <li><code>src</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> &#x8981;&#x62F7;&#x8D1D;&#x7684;&#x6E90;&#x6587;&#x4EF6;&#x540D;&#x3002;</li>
  <li><code>dest</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> &#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x540D;&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x7528;&#x4E8E;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x4FEE;&#x9970;&#x7B26;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  <li><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x5C06; <code>src</code> &#x62F7;&#x8D1D;&#x5230; <code>dest</code>&#x3002;
  &#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5982;&#x679C; <code>dest</code> &#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x8986;&#x76D6;&#x5B83;&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x56DE;&#x8C03;&#x51FD;&#x6570;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;
  Node.js &#x4E0D;&#x4FDD;&#x8BC1;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x539F;&#x5B50;&#x6027;&#x3002;
  &#x5982;&#x679C;&#x5728;&#x6253;&#x5F00;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x5199;&#x5165;&#x540E;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#xFF0C;&#x5219; Node.js &#x5C06;&#x5C1D;&#x8BD5;&#x5220;&#x9664;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x3002;</p>
  <p><code>mode</code> &#x662F;&#x4E00;&#x4E2A;&#x53EF;&#x9009;&#x7684;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x884C;&#x4E3A;&#x3002;
  &#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x7531;&#x4E24;&#x4E2A;&#x6216;&#x66F4;&#x591A;&#x4E2A;&#x503C;&#x6309;&#x4F4D;&#x6216;&#x7EC4;&#x6210;&#x7684;&#x63A9;&#x7801;&#xFF08;&#x6BD4;&#x5982; <code>fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE</code>&#xFF09;&#x3002;</p>
  <ul>
  <li><code>fs.constants.COPYFILE_EXCL</code> - &#x5982;&#x679C; <code>dest</code> &#x5DF2;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</li>
  <li><code>fs.constants.COPYFILE_FICLONE</code> - &#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5C1D;&#x8BD5;&#x521B;&#x5EFA;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF08;copy-on-write&#xFF09;&#x94FE;&#x63A5;&#x3002;&#x5982;&#x679C;&#x5E73;&#x53F0;&#x4E0D;&#x652F;&#x6301;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF0C;&#x5219;&#x4F7F;&#x7528;&#x540E;&#x5907;&#x7684;&#x62F7;&#x8D1D;&#x673A;&#x5236;&#x3002;</li>
  <li><code>fs.constants.COPYFILE_FICLONE_FORCE</code> - &#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5C1D;&#x8BD5;&#x521B;&#x5EFA;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#x94FE;&#x63A5;&#x3002;&#x5982;&#x679C;&#x5E73;&#x53F0;&#x4E0D;&#x652F;&#x6301;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF0C;&#x5219;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</li>
  </ul>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  <span class="hljs-keyword">const</span> { COPYFILE_EXCL } = fs.constants;
  
  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callback</span>(<span class="hljs-params">err</span>) </span>{
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;&#x5DF2;&#x62F7;&#x8D1D;&#x5230;&#x76EE;&#x6807;&#x6587;&apos;</span>);
  }
  
  <span class="hljs-comment">// &#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x5C06;&#x521B;&#x5EFA;&#x6216;&#x8986;&#x76D6;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x3002;</span>
  fs.copyFile(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x76EE;&#x6807;&#x6587;&#x4EF6;.txt&apos;</span>, callback);
  
  <span class="hljs-comment">// &#x901A;&#x8FC7;&#x4F7F;&#x7528; COPYFILE_EXCL&#xFF0C;&#x5982;&#x679C;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</span>
  fs.copyFile(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x76EE;&#x6807;&#x6587;&#x4EF6;.txt&apos;</span>, COPYFILE_EXCL, callback);</code></pre>
  <h2><code>fs.copyFileSync(src, dest[, mode])</code><span><a class="mark" href="#fs_fs_copyfilesync_src_dest_mode" id="fs_fs_copyfilesync_src_dest_mode">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_copyfilesync_src_dest_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_copyfilesync_src_dest_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v8.5.0</span>
  </div>
  <ul>
  <li><code>src</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> &#x8981;&#x62F7;&#x8D1D;&#x7684;&#x6E90;&#x6587;&#x4EF6;&#x540D;&#x3002;</li>
  <li><code>dest</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> &#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x540D;&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x7528;&#x4E8E;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x4FEE;&#x9970;&#x7B26;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  </ul>
  <p>&#x540C;&#x6B65;&#x5730;&#x5C06; <code>src</code> &#x62F7;&#x8D1D;&#x5230; <code>dest</code>&#x3002;
  &#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5982;&#x679C; <code>dest</code> &#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x8986;&#x76D6;&#x5B83;&#x3002;
  &#x8FD4;&#x56DE; <code>undefined</code>&#x3002;
  Node.js &#x4E0D;&#x4FDD;&#x8BC1;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x539F;&#x5B50;&#x6027;&#x3002;
  &#x5982;&#x679C;&#x5728;&#x6253;&#x5F00;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x5199;&#x5165;&#x540E;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#xFF0C;&#x5219; Node.js &#x5C06;&#x5C1D;&#x8BD5;&#x5220;&#x9664;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x3002;</p>
  <p><code>mode</code> &#x662F;&#x4E00;&#x4E2A;&#x53EF;&#x9009;&#x7684;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x884C;&#x4E3A;&#x3002;
  &#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x7531;&#x4E24;&#x4E2A;&#x6216;&#x66F4;&#x591A;&#x4E2A;&#x503C;&#x6309;&#x4F4D;&#x6216;&#x7EC4;&#x6210;&#x7684;&#x63A9;&#x7801;&#xFF08;&#x6BD4;&#x5982; <code>fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE</code>&#xFF09;&#x3002;</p>
  <ul>
  <li><code>fs.constants.COPYFILE_EXCL</code> - &#x5982;&#x679C; <code>dest</code> &#x5DF2;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</li>
  <li><code>fs.constants.COPYFILE_FICLONE</code> - &#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5C1D;&#x8BD5;&#x521B;&#x5EFA;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF08;copy-on-write&#xFF09;&#x94FE;&#x63A5;&#x3002;&#x5982;&#x679C;&#x5E73;&#x53F0;&#x4E0D;&#x652F;&#x6301;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF0C;&#x5219;&#x4F7F;&#x7528;&#x540E;&#x5907;&#x7684;&#x62F7;&#x8D1D;&#x673A;&#x5236;&#x3002;</li>
  <li><code>fs.constants.COPYFILE_FICLONE_FORCE</code> - &#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5C1D;&#x8BD5;&#x521B;&#x5EFA;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#x94FE;&#x63A5;&#x3002;&#x5982;&#x679C;&#x5E73;&#x53F0;&#x4E0D;&#x652F;&#x6301;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF0C;&#x5219;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</li>
  </ul>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  <span class="hljs-keyword">const</span> { COPYFILE_EXCL } = fs.constants;
  
  <span class="hljs-comment">// &#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x5C06;&#x521B;&#x5EFA;&#x6216;&#x8986;&#x76D6;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x3002;</span>
  fs.copyFileSync(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x76EE;&#x6807;&#x6587;&#x4EF6;.txt&apos;</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;&#x5DF2;&#x62F7;&#x8D1D;&#x5230;&#x76EE;&#x6807;&#x6587;&#x4EF6;&apos;</span>);
  
  <span class="hljs-comment">// &#x901A;&#x8FC7;&#x4F7F;&#x7528; COPYFILE_EXCL&#xFF0C;&#x5982;&#x679C;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</span>
  fs.copyFileSync(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x76EE;&#x6807;&#x6587;&#x4EF6;.txt&apos;</span>, COPYFILE_EXCL);</code></pre>
  <h2><code>fs.createReadStream(path[, options])</code><span><a class="mark" href="#fs_fs_createreadstream_path_options" id="fs_fs_createreadstream_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_createreadstream_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_createreadstream_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.6.0</td>
  <td><p>&#x9009;&#x9879; <code>fs</code> &#x53EF;&#x4EE5;&#x91CD;&#x5199;&#x4F7F;&#x7528;&#x7684; <code>fs</code> &#x5B9E;&#x73B0;&#x3002;</p></td></tr>
  <tr><td>v12.10.0</td>
  <td><p>&#x542F;&#x7528; <code>emitClose</code> &#x9009;&#x9879;&#x3002;</p></td></tr>
  <tr><td>v11.0.0</td>
  <td><p>&#x5BF9; <code>start</code> &#x548C; <code>end</code> &#x65BD;&#x52A0;&#x65B0;&#x7684;&#x7EA6;&#x675F;&#xFF0C;&#x5F53;&#x65E0;&#x6CD5;&#x5408;&#x7406;&#x5730;&#x5904;&#x7406;&#x8F93;&#x5165;&#x7684;&#x503C;&#x65F6;&#xFF0C;&#x5219;&#x629B;&#x51FA;&#x66F4;&#x6070;&#x5F53;&#x7684;&#x9519;&#x8BEF;&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x4F20;&#x5165;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#x65E0;&#x6CD5;&#x518D;&#x88AB;&#x4FEE;&#x6539;&#x3002;</p></td></tr>
  <tr><td>v2.3.0</td>
  <td><p>&#x4F20;&#x5165;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>flags</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;r&apos;</code>&#x3002;</li>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>null</code>&#x3002;</li>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>null</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#x3002;</li>
  <li><code>autoClose</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>true</code>&#x3002;</li>
  <li><code>emitClose</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>start</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>end</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>Infinity</code>&#x3002;</li>
  <li><code>highWaterMark</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>64 * 1024</code>&#x3002;</li>
  <li><code>fs</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>null</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/C3Eioq" target="_blank" rel="nofollow" class="type">&lt;fs.ReadStream&gt;</a> &#x53C2;&#x89C1;<a href="/s/vx79o1" rel="nofollow">&#x53EF;&#x8BFB;&#x6D41;</a>&#x3002;</li>
  </ul>
  <p>&#x4E0E;&#x53EF;&#x8BFB;&#x6D41;&#x7684; 16 kb &#x7684;&#x9ED8;&#x8BA4; <code>highWaterMark</code> &#x4E0D;&#x540C;&#xFF0C;&#x6B64;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x7684;&#x6D41;&#x5177;&#x6709; 64 kb &#x7684;&#x9ED8;&#x8BA4; <code>highWaterMark</code>&#x3002;</p>
  <p><code>options</code> &#x53EF;&#x4EE5;&#x5305;&#x62EC; <code>start</code> &#x548C; <code>end</code> &#x503C;&#xFF0C;&#x7528;&#x4E8E;&#x4ECE;&#x6587;&#x4EF6;&#x4E2D;&#x8BFB;&#x53D6;&#x4E00;&#x5B9A;&#x8303;&#x56F4;&#x7684;&#x5B57;&#x8282;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x8BFB;&#x53D6;&#x6574;&#x4E2A;&#x6587;&#x4EF6;&#x3002;
  <code>start</code> &#x548C; <code>end</code> &#x90FD;&#x662F;&#x5305;&#x542B;&#x7684;&#xFF0C;&#x5E76;&#x4E14;&#x4ECE; 0 &#x5F00;&#x59CB;&#x8BA1;&#x6570;&#xFF0C;&#x5141;&#x8BB8;&#x7684;&#x503C;&#x5728; [0, <a href="/s/e9ereu" rel="nofollow"><code>Number.MAX_SAFE_INTEGER</code></a>] &#x7684;&#x8303;&#x56F4;&#x5185;&#x3002;
  &#x5982;&#x679C;&#x6307;&#x5B9A;&#x4E86; <code>fd</code>&#xFF0C;&#x5E76;&#x4E14;&#x7701;&#x7565; <code>start</code> &#x6216;&#x4E3A; <code>undefined</code>&#xFF0C;&#x5219; <code>fs.createReadStream()</code> &#x4F1A;&#x4ECE;&#x5F53;&#x524D;&#x7684;&#x6587;&#x4EF6;&#x4F4D;&#x7F6E;&#x7EE7;&#x7EED;&#x8BFB;&#x53D6;&#x3002;
  <code>encoding</code> &#x53EF;&#x4EE5;&#x662F;&#x80FD;&#x88AB; <a href="/s/FApxjh" rel="nofollow"><code>Buffer</code></a> &#x63A5;&#x53D7;&#x7684;&#x4EFB;&#x4F55;&#x4E00;&#x79CD;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x6307;&#x5B9A;&#x4E86; <code>fd</code>&#xFF0C;&#x5219; <code>ReadStream</code> &#x4F1A;&#x5FFD;&#x7565; <code>path</code> &#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x4E14;&#x4F1A;&#x4F7F;&#x7528;&#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;
  &#x8FD9;&#x610F;&#x5473;&#x7740;&#x4E0D;&#x4F1A;&#x89E6;&#x53D1; <code>&apos;open&apos;</code> &#x4E8B;&#x4EF6;&#x3002;
  <code>fd</code> &#x5FC5;&#x987B;&#x662F;&#x963B;&#x585E;&#x7684;&#xFF0C;&#x975E;&#x963B;&#x585E;&#x7684; <code>fd</code> &#x5E94;&#x8BE5;&#x4F20;&#x7ED9; <a href="/s/wsJ1o1" rel="nofollow"><code>net.Socket</code></a>&#x3002;</p>
  <p>&#x5982;&#x679C; <code>fd</code> &#x6307;&#x5411;&#x4EC5;&#x652F;&#x6301;&#x963B;&#x585E;&#x8BFB;&#x53D6;&#x7684;&#x5B57;&#x7B26;&#x8BBE;&#x5907;&#xFF08;&#x4F8B;&#x5982;&#x952E;&#x76D8;&#x6216;&#x58F0;&#x5361;&#xFF09;&#xFF0C;&#x5219;&#x5728;&#x6570;&#x636E;&#x53EF;&#x7528;&#x4E4B;&#x524D;&#xFF0C;&#x8BFB;&#x53D6;&#x64CD;&#x4F5C;&#x4E0D;&#x4F1A;&#x7ED3;&#x675F;&#x3002;
  &#x8FD9;&#x53EF;&#x4EE5;&#x9632;&#x6B62;&#x8FDB;&#x7A0B;&#x7684;&#x9000;&#x51FA;&#x4E0E;&#x6D41;&#x7684;&#x81EA;&#x52A8;&#x5173;&#x95ED;&#x3002;</p>
  <p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6D41;&#x88AB;&#x9500;&#x6BC1;&#x4E4B;&#x540E;&#x4E0D;&#x4F1A;&#x89E6;&#x53D1; <code>&apos;close&apos;</code> &#x4E8B;&#x4EF6;&#x3002;
  &#x8FD9;&#x4E0E;&#x5176;&#x4ED6; <code>Readable</code> &#x6D41;&#x7684;&#x9ED8;&#x8BA4;&#x8BBE;&#x7F6E;&#x662F;&#x76F8;&#x53CD;&#x7684;&#x3002;
  &#x8BBE;&#x7F6E; <code>emitClose</code> &#x9009;&#x9879;&#x4E3A; <code>true</code> &#x53EF;&#x4EE5;&#x66F4;&#x6539;&#x6B64;&#x884C;&#x4E3A;&#x3002;</p>
  <p>&#x901A;&#x8FC7;&#x63D0;&#x4F9B; <code>fs</code> &#x9009;&#x9879;&#xFF0C;&#x53EF;&#x4EE5;&#x91CD;&#x5199;&#x5BF9;&#x5E94;&#x7684; <code>fs</code> &#x5B9E;&#x73B0;&#xFF08;&#x7528;&#x4E8E; <code>open</code>&#x3001; <code>read</code> &#x548C; <code>close</code>&#xFF09;&#x3002;
  &#x5F53;&#x63D0;&#x4F9B; <code>fs</code> &#x9009;&#x9879;&#x65F6;&#xFF0C;&#x5219;&#x5FC5;&#x987B;&#x91CD;&#x5199; <code>open</code>&#x3001; <code>read</code> &#x548C; <code>close</code>&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  <span class="hljs-comment">// &#x4ECE;&#x67D0;&#x4E2A;&#x5B57;&#x7B26;&#x8BBE;&#x5907;&#x521B;&#x5EFA;&#x6D41;&#x3002;</span>
  <span class="hljs-keyword">const</span> stream = fs.createReadStream(<span class="hljs-string">&apos;&#x8BBE;&#x5907;&apos;</span>);
  setTimeout(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {
    stream.close(); <span class="hljs-comment">// &#x8FD9;&#x53EF;&#x80FD;&#x4E0D;&#x4F1A;&#x5173;&#x95ED;&#x6D41;&#x3002;</span>
    <span class="hljs-comment">// &#x624B;&#x52A8;&#x6807;&#x8BB0;&#x6D41;&#x7684;&#x7ED3;&#x675F;&#xFF0C;&#x5C31;&#x50CF;&#x5E95;&#x5C42;&#x7684;&#x8D44;&#x6E90;&#x81EA;&#x8EAB;&#x5DF2;&#x8868;&#x660E;&#x6587;&#x4EF6;&#x7684;&#x7ED3;&#x675F;&#x4E00;&#x6837;&#xFF0C;&#x4F7F;&#x5F97;&#x6D41;&#x53EF;&#x4EE5;&#x5173;&#x95ED;&#x3002;</span>
    <span class="hljs-comment">// &#x8FD9;&#x4E0D;&#x4F1A;&#x53D6;&#x6D88;&#x5F85;&#x5904;&#x7406;&#x7684;&#x8BFB;&#x53D6;&#x64CD;&#x4F5C;&#xFF0C;&#x5982;&#x679C;&#x5B58;&#x5728;&#x6B64;&#x7C7B;&#x64CD;&#x4F5C;&#xFF0C;&#x5219;&#x8FDB;&#x7A0B;&#x53EF;&#x80FD;&#x4ECD;&#x65E0;&#x6CD5;&#x6210;&#x529F;&#x5730;&#x9000;&#x51FA;&#xFF0C;&#x76F4;&#x5230;&#x5B8C;&#x6210;&#x3002;</span>
    stream.push(<span class="hljs-literal">null</span>);
    stream.read(<span class="hljs-number">0</span>);
  }, <span class="hljs-number">100</span>);</code></pre>
  <p>&#x5982;&#x679C; <code>autoClose</code> &#x4E3A; false&#xFF0C;&#x5219;&#x5373;&#x4F7F;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#xFF0C;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x4E5F;&#x4E0D;&#x4F1A;&#x88AB;&#x5173;&#x95ED;&#x3002;
  &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x9700;&#x8981;&#x8D1F;&#x8D23;&#x5173;&#x95ED;&#x5B83;&#x5E76;&#x786E;&#x4FDD;&#x6CA1;&#x6709;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x6CC4;&#x6F0F;&#x3002;
  &#x5982;&#x679C; <code>autoClose</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; true&#xFF08;&#x9ED8;&#x8BA4;&#x7684;&#x884C;&#x4E3A;&#xFF09;&#xFF0C;&#x5219;&#x5F53; <code>&apos;error&apos;</code> &#x6216; <code>&apos;end&apos;</code> &#x4E8B;&#x4EF6;&#x65F6;&#xFF0C;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x4F1A;&#x88AB;&#x81EA;&#x52A8;&#x5730;&#x5173;&#x95ED;&#x3002;</p>
  <p><code>mode</code> &#x7528;&#x4E8E;&#x8BBE;&#x7F6E;&#x6587;&#x4EF6;&#x6A21;&#x5F0F;&#xFF08;&#x6743;&#x9650;&#x548C;&#x7C98;&#x6EDE;&#x4F4D;&#xFF09;&#xFF0C;&#x4F46;&#x4EC5;&#x9650;&#x4E8E;&#x6587;&#x4EF6;&#x88AB;&#x521B;&#x5EFA;&#x65F6;&#x3002;</p>
  <p>&#x793A;&#x4F8B;&#xFF0C;&#x8BFB;&#x53D6;&#x6587;&#x4EF6;&#xFF08;&#x957F;&#x5EA6;&#x4E3A; 100 &#x4E2A;&#x5B57;&#x8282;&#xFF09;&#x7684;&#x6700;&#x540E; 10 &#x4E2A;&#x5B57;&#x8282;&#xFF1A;</p>
  <pre><code class="language-js">fs.createReadStream(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>, { <span class="hljs-attr">start</span>: <span class="hljs-number">90</span>, <span class="hljs-attr">end</span>: <span class="hljs-number">99</span> });</code></pre>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <h2><code>fs.createWriteStream(path[, options])</code><span><a class="mark" href="#fs_fs_createwritestream_path_options" id="fs_fs_createwritestream_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_createwritestream_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_createwritestream_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.6.0</td>
  <td><p>&#x9009;&#x9879; <code>fs</code> &#x53EF;&#x4EE5;&#x91CD;&#x5199;&#x4F7F;&#x7528;&#x7684; <code>fs</code> &#x5B9E;&#x73B0;&#x3002;</p></td></tr>
  <tr><td>v12.10.0</td>
  <td><p>&#x542F;&#x7528; <code>emitClose</code> &#x9009;&#x9879;&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x4F20;&#x5165;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#x65E0;&#x6CD5;&#x518D;&#x88AB;&#x4FEE;&#x6539;&#x3002;</p></td></tr>
  <tr><td>v5.5.0</td>
  <td><p>&#x652F;&#x6301; <code>autoClose</code> &#x9009;&#x9879;&#x3002;</p></td></tr>
  <tr><td>v2.3.0</td>
  <td><p>&#x4F20;&#x5165;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>flags</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;w&apos;</code>&#x3002;</li>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>null</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#x3002;</li>
  <li><code>autoClose</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>true</code>&#x3002;</li>
  <li><code>emitClose</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>start</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>fs</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>null</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/2uZDVA" target="_blank" rel="nofollow" class="type">&lt;fs.WriteStream&gt;</a> &#x53C2;&#x89C1;<a href="/s/9JUnJ8" rel="nofollow">&#x53EF;&#x5199;&#x6D41;</a>&#x3002;</li>
  </ul>
  <p><code>options</code> &#x8FD8;&#x53EF;&#x4EE5;&#x5305;&#x62EC; <code>start</code> &#x9009;&#x9879;&#xFF0C;&#x7528;&#x4E8E;&#x5199;&#x5165;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#x5F00;&#x5934;&#x4E4B;&#x540E;&#x7684;&#x67D0;&#x4E2A;&#x4F4D;&#x7F6E;&#xFF0C;&#x5141;&#x8BB8;&#x7684;&#x503C;&#x5728; [0, <a href="/s/e9ereu" rel="nofollow"><code>Number.MAX_SAFE_INTEGER</code></a>] &#x7684;&#x8303;&#x56F4;&#x5185;&#x3002;
  &#x82E5;&#x8981;&#x4FEE;&#x6539;&#x6587;&#x4EF6;&#x800C;&#x4E0D;&#x662F;&#x8986;&#x76D6;&#x6587;&#x4EF6;&#xFF0C;&#x5219;&#x9700;&#x8981; <code>flags</code> &#x9009;&#x9879;&#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>r+</code> &#x800C;&#x4E0D;&#x662F;&#x9ED8;&#x8BA4;&#x7684; <code>w</code>&#x3002;
  <code>encoding</code> &#x53EF;&#x4EE5;&#x662F;&#x80FD;&#x88AB; <a href="/s/FApxjh" rel="nofollow"><code>Buffer</code></a> &#x63A5;&#x53D7;&#x7684;&#x4EFB;&#x4F55;&#x4E00;&#x79CD;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>autoClose</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; true&#xFF08;&#x9ED8;&#x8BA4;&#x7684;&#x884C;&#x4E3A;&#xFF09;&#xFF0C;&#x5219;&#x5F53; <code>&apos;error&apos;</code> &#x6216; <code>&apos;finish&apos;</code> &#x4E8B;&#x4EF6;&#x65F6;&#xFF0C;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x4F1A;&#x88AB;&#x81EA;&#x52A8;&#x5730;&#x5173;&#x95ED;&#x3002;
  &#x5982;&#x679C; <code>autoClose</code> &#x4E3A; false&#xFF0C;&#x5219;&#x5373;&#x4F7F;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#xFF0C;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x4E5F;&#x4E0D;&#x4F1A;&#x88AB;&#x5173;&#x95ED;&#x3002;
  &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x9700;&#x8981;&#x8D1F;&#x8D23;&#x5173;&#x95ED;&#x5B83;&#x5E76;&#x786E;&#x4FDD;&#x6CA1;&#x6709;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x6CC4;&#x6F0F;&#x3002;</p>
  <p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6D41;&#x88AB;&#x9500;&#x6BC1;&#x4E4B;&#x540E;&#x4E0D;&#x4F1A;&#x89E6;&#x53D1; <code>&apos;close&apos;</code> &#x4E8B;&#x4EF6;&#x3002;
  &#x8FD9;&#x4E0E;&#x5176;&#x4ED6; <code>Writable</code> &#x6D41;&#x7684;&#x9ED8;&#x8BA4;&#x8BBE;&#x7F6E;&#x662F;&#x76F8;&#x53CD;&#x7684;&#x3002;
  &#x8BBE;&#x7F6E; <code>emitClose</code> &#x9009;&#x9879;&#x4E3A; <code>true</code> &#x53EF;&#x4EE5;&#x66F4;&#x6539;&#x6B64;&#x884C;&#x4E3A;&#x3002;</p>
  <p>&#x901A;&#x8FC7;&#x63D0;&#x4F9B; <code>fs</code> &#x9009;&#x9879;&#xFF0C;&#x53EF;&#x4EE5;&#x91CD;&#x5199;&#x5BF9;&#x5E94;&#x7684; <code>fs</code> &#x5B9E;&#x73B0;&#xFF08;&#x7528;&#x4E8E; <code>open</code>&#x3001; <code>write</code>&#x3001; <code>writev</code> &#x548C; <code>close</code>&#xFF09;&#x3002;
  &#x5982;&#x679C;&#x91CD;&#x5199; <code>write()</code> &#x4F46;&#x6CA1;&#x6709;&#x91CD;&#x5199; <code>writev()</code>&#xFF0C;&#x5219;&#x4F1A;&#x964D;&#x4F4E;&#x6027;&#x80FD;&#xFF0C;&#x56E0;&#x4E3A;&#x67D0;&#x4E9B;&#x4F18;&#x5316;&#xFF08;<code>_writev()</code>&#xFF09;&#x4F1A;&#x88AB;&#x7981;&#x7528;&#x3002;
  &#x5F53;&#x63D0;&#x4F9B; <code>fs</code> &#x9009;&#x9879;&#x65F6;&#xFF0C;&#x5219;&#x5FC5;&#x987B;&#x91CD;&#x5199; <code>open</code>&#x3001; <code>close</code>&#x3001;&#x4EE5;&#x53CA; <code>write</code> &#x548C; <code>writev</code> &#x4E24;&#x8005;&#x81F3;&#x5C11;&#x5176;&#x4E2D;&#x4E4B;&#x4E00;&#x3002;</p>
  <p>&#x4E0E; <a href="/s/C3Eioq" rel="nofollow"><code>ReadStream</code></a> &#x4E00;&#x6837;&#xFF0C;&#x5982;&#x679C;&#x6307;&#x5B9A;&#x4E86; <code>fd</code>&#xFF0C;&#x5219; <a href="/s/2uZDVA" rel="nofollow"><code>WriteStream</code></a> &#x4F1A;&#x5FFD;&#x7565; <code>path</code> &#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x4E14;&#x4F1A;&#x4F7F;&#x7528;&#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;
  &#x8FD9;&#x610F;&#x5473;&#x7740;&#x4E0D;&#x4F1A;&#x89E6;&#x53D1; <code>&apos;open&apos;</code> &#x4E8B;&#x4EF6;&#x3002;
  <code>fd</code> &#x5FC5;&#x987B;&#x662F;&#x963B;&#x585E;&#x7684;&#xFF0C;&#x975E;&#x963B;&#x585E;&#x7684; <code>fd</code> &#x5E94;&#x8BE5;&#x4F20;&#x7ED9; <a href="/s/wsJ1o1" rel="nofollow"><code>net.Socket</code></a>&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <h2><code>fs.exists(path, callback)</code><span><a class="mark" href="#fs_fs_exists_path_callback" id="fs_fs_exists_path_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_exists_path_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_exists_path_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v1.0.0</td>
  <td><p><span>&#x5F03;&#x7528;&#x4E8E;: v1.0.0</span></p></td></tr>
  <tr><td>v0.0.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.0.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <p></p><div class="api_stability api_stability_0"><a target="_blank" rel="nofollow" href="/api/documentation.html#documentation_stability_index">&#x7A33;&#x5B9A;&#x6027;: 0</a> - &#x5F03;&#x7528;: &#x6539;&#x4E3A;&#x4F7F;&#x7528; <a href="/s/fdrjxj" rel="nofollow"><code>fs.stat()</code></a> &#x6216; <a href="/s/NCPsM3" rel="nofollow"><code>fs.access()</code></a>&#x3002;</div><p></p>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>exists</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x901A;&#x8FC7;&#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x6765;&#x6D4B;&#x8BD5;&#x7ED9;&#x5B9A;&#x7684;&#x8DEF;&#x5F84;&#x662F;&#x5426;&#x5B58;&#x5728;&#x3002;
  &#x7136;&#x540E;&#x8C03;&#x7528; <code>callback</code> &#x5E76;&#x5E26;&#x4E0A;&#x53C2;&#x6570; <code>true</code> &#x6216; <code>false</code>&#xFF1A;</p>
  <pre><code class="language-js">fs.exists(<span class="hljs-string">&apos;/etc/passwd&apos;</span>, (exists) =&gt; {
    <span class="hljs-built_in">console</span>.log(exists ? <span class="hljs-string">&apos;&#x5B58;&#x5728;&apos;</span> : <span class="hljs-string">&apos;&#x4E0D;&#x5B58;&#x5728;&apos;</span>);
  });</code></pre>
  <p>&#x6B64;&#x56DE;&#x8C03;&#x7684;&#x53C2;&#x6570;&#x4E0E;&#x5176;&#x4ED6; Node.js &#x56DE;&#x8C03;&#x4E0D;&#x4E00;&#x81F4;&#x3002;
  &#x901A;&#x5E38;&#xFF0C;Node.js &#x56DE;&#x8C03;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x662F; <code>err</code> &#x53C2;&#x6570;&#xFF0C;&#x540E;&#x9762;&#x53EF;&#x9009;&#x5730;&#x8DDF;&#x968F;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;
  <code>fs.exists()</code> &#x7684;&#x56DE;&#x8C03;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x5E03;&#x5C14;&#x503C;&#x53C2;&#x6570;&#x3002;
  &#x8FD9;&#x662F;&#x63A8;&#x8350; <code>fs.access()</code> &#x4EE3;&#x66FF; <code>fs.exists()</code> &#x7684;&#x539F;&#x56E0;&#x4E4B;&#x4E00;&#x3002;</p>
  <p>&#x4E0D;&#x5EFA;&#x8BAE;&#x5728;&#x8C03;&#x7528; <code>fs.open()</code>&#x3001; <code>fs.readFile()</code> &#x6216; <code>fs.writeFile()</code> &#x4E4B;&#x524D;&#x4F7F;&#x7528; <code>fs.exists()</code> &#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x5B58;&#x5728;&#x3002;
  &#x8FD9;&#x6837;&#x505A;&#x4F1A;&#x5F15;&#x5165;&#x7ADE;&#x6001;&#x6761;&#x4EF6;&#xFF0C;&#x56E0;&#x4E3A;&#x5176;&#x4ED6;&#x8FDB;&#x7A0B;&#x53EF;&#x80FD;&#x4F1A;&#x5728;&#x4E24;&#x6B21;&#x8C03;&#x7528;&#x4E4B;&#x95F4;&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x72B6;&#x6001;&#x3002;
  &#x76F8;&#x53CD;&#xFF0C;&#x5E94;&#x8BE5;&#x76F4;&#x63A5;&#x6253;&#x5F00;&#x3001;&#x8BFB;&#x53D6;&#x6216;&#x5199;&#x5165;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&#x5219;&#x5904;&#x7406;&#x5F15;&#x53D1;&#x7684;&#x9519;&#x8BEF;&#x3002;</p>
  <p><strong>&#x5199;&#x5165;&#xFF08;&#x4E0D;&#x63A8;&#x8350;&#xFF09;</strong></p>
  <pre><code class="language-js">fs.exists(<span class="hljs-string">&apos;myfile&apos;</span>, (exists) =&gt; {
    <span class="hljs-keyword">if</span> (exists) {
      <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;myfile &#x5DF2;&#x5B58;&#x5728;&apos;</span>);
    } <span class="hljs-keyword">else</span> {
      fs.open(<span class="hljs-string">&apos;myfile&apos;</span>, <span class="hljs-string">&apos;wx&apos;</span>, (err, fd) =&gt; {
        <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
        writeMyData(fd);
      });
    }
  });</code></pre>
  <p><strong>&#x5199;&#x5165;&#xFF08;&#x63A8;&#x8350;&#xFF09;</strong></p>
  <pre><code class="language-js">fs.open(<span class="hljs-string">&apos;myfile&apos;</span>, <span class="hljs-string">&apos;wx&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-keyword">if</span> (err) {
      <span class="hljs-keyword">if</span> (err.code === <span class="hljs-string">&apos;EEXIST&apos;</span>) {
        <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;myfile &#x5DF2;&#x5B58;&#x5728;&apos;</span>);
        <span class="hljs-keyword">return</span>;
      }
  
      <span class="hljs-keyword">throw</span> err;
    }
  
    writeMyData(fd);
  });</code></pre>
  <p><strong>&#x8BFB;&#x53D6;&#xFF08;&#x4E0D;&#x63A8;&#x8350;&#xFF09;</strong></p>
  <pre><code class="language-js">fs.exists(<span class="hljs-string">&apos;myfile&apos;</span>, (exists) =&gt; {
    <span class="hljs-keyword">if</span> (exists) {
      fs.open(<span class="hljs-string">&apos;myfile&apos;</span>, <span class="hljs-string">&apos;r&apos;</span>, (err, fd) =&gt; {
        <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
        readMyData(fd);
      });
    } <span class="hljs-keyword">else</span> {
      <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;myfile &#x4E0D;&#x5B58;&#x5728;&apos;</span>);
    }
  });</code></pre>
  <p><strong>&#x8BFB;&#x53D6;&#xFF08;&#x63A8;&#x8350;&#xFF09;</strong></p>
  <pre><code class="language-js">fs.open(<span class="hljs-string">&apos;myfile&apos;</span>, <span class="hljs-string">&apos;r&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-keyword">if</span> (err) {
      <span class="hljs-keyword">if</span> (err.code === <span class="hljs-string">&apos;ENOENT&apos;</span>) {
        <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;myfile &#x4E0D;&#x5B58;&#x5728;&apos;</span>);
        <span class="hljs-keyword">return</span>;
      }
  
      <span class="hljs-keyword">throw</span> err;
    }
  
    readMyData(fd);
  });</code></pre>
  <p>&#x4E0A;&#x9762;&#x7684;&#x201C;&#x4E0D;&#x63A8;&#x8350;&#x201D;&#x793A;&#x4F8B;&#x4F1A;&#x5148;&#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x5B58;&#x5728;&#x7136;&#x540E;&#x518D;&#x4F7F;&#x7528;&#x8BE5;&#x6587;&#x4EF6;&#x3002;
  &#x201C;&#x63A8;&#x8350;&#x201D;&#x793A;&#x4F8B;&#x5219;&#x66F4;&#x597D;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x4EEC;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x6587;&#x4EF6;&#x5E76;&#x5904;&#x7406;&#x9519;&#x8BEF;&#xFF08;&#x5982;&#x679C;&#x6709;&#x9519;&#x8BEF;&#x7684;&#x8BDD;&#xFF09;&#x3002;</p>
  <p>&#x901A;&#x5E38;&#xFF0C;&#x4EC5;&#x5728;&#x6587;&#x4EF6;&#x4E0D;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x65F6;&#x624D;&#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x5B58;&#x5728;&#xFF0C;&#x4F8B;&#x5982;&#x5F53;&#x5176;&#x5B58;&#x5728;&#x6027;&#x662F;&#x6765;&#x81EA;&#x53E6;&#x4E00;&#x4E2A;&#x8FDB;&#x7A0B;&#x7684;&#x4FE1;&#x53F7;&#x65F6;&#x3002;</p>
  <h2><code>fs.existsSync(path)</code><span><a class="mark" href="#fs_fs_existssync_path" id="fs_fs_existssync_path">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_existssync_path.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_existssync_path.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a></li>
  </ul>
  <p>&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#xFF0C;&#x5426;&#x5219;&#x8FD4;&#x56DE; <code>false</code>&#x3002;</p>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/udxWhD" rel="nofollow"><code>fs.exists()</code></a>&#x3002;</p>
  <p>&#x867D;&#x7136; <code>fs.exists()</code> &#x662F;&#x5F03;&#x7528;&#x7684;&#xFF0C;&#x4F46; <code>fs.existsSync()</code> &#x4E0D;&#x662F;&#x5F03;&#x7528;&#x7684;&#x3002;
  <code>fs.exists()</code> &#x7684; <code>callback</code> &#x53C2;&#x6570;&#x63A5;&#x53D7;&#x7684;&#x53C2;&#x6570;&#x4E0E;&#x5176;&#x4ED6;&#x7684; Node.js &#x56DE;&#x8C03;&#x7684;&#x4E0D;&#x4E00;&#x81F4;&#x3002;
  <code>fs.existsSync()</code> &#x4E0D;&#x4F7F;&#x7528;&#x56DE;&#x8C03;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">if</span> (fs.existsSync(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&apos;</span>)) {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8BE5;&#x8DEF;&#x5F84;&#x5DF2;&#x5B58;&#x5728;&apos;</span>);
  }</code></pre>
  <h2><code>fs.fchmod(fd, mode, callback)</code><span><a class="mark" href="#fs_fs_fchmod_fd_mode_callback" id="fs_fs_fchmod_fd_mode_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fchmod_fd_mode_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fchmod_fd_mode_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.4.7</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.4.7</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/L3LQRh" rel="nofollow"><code>fchmod(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <h2><code>fs.fchmodSync(fd, mode)</code><span><a class="mark" href="#fs_fs_fchmodsync_fd_mode" id="fs_fs_fchmodsync_fd_mode">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fchmodsync_fd_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fchmodsync_fd_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.4.7</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/L3LQRh" rel="nofollow"><code>fchmod(2)</code></a>&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.fchown(fd, uid, gid, callback)</code><span><a class="mark" href="#fs_fs_fchown_fd_uid_gid_callback" id="fs_fs_fchown_fd_uid_gid_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fchown_fd_uid_gid_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fchown_fd_uid_gid_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.4.7</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.4.7</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>uid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>gid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/vZfXQ2" rel="nofollow"><code>fchown(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <h2><code>fs.fchownSync(fd, uid, gid)</code><span><a class="mark" href="#fs_fs_fchownsync_fd_uid_gid" id="fs_fs_fchownsync_fd_uid_gid">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fchownsync_fd_uid_gid.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fchownsync_fd_uid_gid.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.4.7</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>uid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>gid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/vZfXQ2" rel="nofollow"><code>fchown(2)</code></a>&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.fdatasync(fd, callback)</code><span><a class="mark" href="#fs_fs_fdatasync_fd_callback" id="fs_fs_fdatasync_fd_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fdatasync_fd_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fdatasync_fd_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.1.96</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.96</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/AEp6fv" rel="nofollow"><code>fdatasync(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <h2><code>fs.fdatasyncSync(fd)</code><span><a class="mark" href="#fs_fs_fdatasyncsync_fd" id="fs_fs_fdatasyncsync_fd">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fdatasyncsync_fd.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fdatasyncsync_fd.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.96</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/AEp6fv" rel="nofollow"><code>fdatasync(2)</code></a>&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.fstat(fd[, options], callback)</code><span><a class="mark" href="#fs_fs_fstat_fd_options_callback" id="fs_fs_fstat_fd_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fstat_fd_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fstat_fd_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>&#x63A5;&#x53D7;&#x989D;&#x5916;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; bigint&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.1.95</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.95</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x8FD4;&#x56DE;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x5E94;&#x4E3A; <code>bigint</code> &#x578B;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>stats</code> <a href="/s/NMuvVx" target="_blank" rel="nofollow" class="type">&lt;fs.Stats&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/anrsLJ" rel="nofollow"><code>fstat(2)</code></a>&#x3002;
  &#x56DE;&#x8C03;&#x4F1A;&#x4F20;&#x5165;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(err, stats)</code>&#xFF0C;&#x5176;&#x4E2D; <code>stats</code> &#x662F; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x3002;
  <code>fstat()</code> &#x4E0E; <a href="/s/fdrjxj" rel="nofollow"><code>stat()</code></a> &#x76F8;&#x540C;&#xFF0C;&#x9664;&#x4E86;&#x6587;&#x4EF6;&#x662F;&#x7531;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26; <code>fd</code> &#x6307;&#x5B9A;&#x3002;</p>
  <h2><code>fs.fstatSync(fd[, options])</code><span><a class="mark" href="#fs_fs_fstatsync_fd_options" id="fs_fs_fstatsync_fd_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fstatsync_fd_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fstatsync_fd_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>&#x63A5;&#x53D7;&#x989D;&#x5916;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; bigint&#x3002;</p></td></tr>
  <tr><td>v0.1.95</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.95</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x8FD4;&#x56DE;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x5E94;&#x4E3A; <code>bigint</code> &#x578B;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/NMuvVx" target="_blank" rel="nofollow" class="type">&lt;fs.Stats&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/anrsLJ" rel="nofollow"><code>fstat(2)</code></a>&#x3002;</p>
  <h2><code>fs.fsync(fd, callback)</code><span><a class="mark" href="#fs_fs_fsync_fd_callback" id="fs_fs_fsync_fd_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fsync_fd_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fsync_fd_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.1.96</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.96</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/d4u3Ks" rel="nofollow"><code>fsync(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <h2><code>fs.fsyncSync(fd)</code><span><a class="mark" href="#fs_fs_fsyncsync_fd" id="fs_fs_fsyncsync_fd">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_fsyncsync_fd.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_fsyncsync_fd.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.96</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/d4u3Ks" rel="nofollow"><code>fsync(2)</code></a>&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.ftruncate(fd[, len], callback)</code><span><a class="mark" href="#fs_fs_ftruncate_fd_len_callback" id="fs_fs_ftruncate_fd_len_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_ftruncate_fd_len_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_ftruncate_fd_len_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.8.6</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.8.6</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>len</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/nU6hxN" rel="nofollow"><code>ftruncate(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x6307;&#x5411;&#x7684;&#x6587;&#x4EF6;&#x5927;&#x4E8E; <code>len</code> &#x4E2A;&#x5B57;&#x8282;&#xFF0C;&#x5219;&#x53EA;&#x6709;&#x524D;&#x9762; <code>len</code> &#x4E2A;&#x5B57;&#x8282;&#x4F1A;&#x4FDD;&#x7559;&#x5728;&#x6587;&#x4EF6;&#x4E2D;&#x3002;</p>
  <p>&#x4F8B;&#x5982;&#xFF0C;&#x4EE5;&#x4E0B;&#x7A0B;&#x5E8F;&#x53EA;&#x4FDD;&#x7559;&#x6587;&#x4EF6;&#x7684;&#x524D; 4 &#x4E2A;&#x5B57;&#x8282;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-built_in">console</span>.log(fs.readFileSync(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>));
  <span class="hljs-comment">// &#x6253;&#x5370;: Node.js</span>
  
  <span class="hljs-comment">// &#x83B7;&#x53D6;&#x8981;&#x622A;&#x65AD;&#x7684;&#x6587;&#x4EF6;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</span>
  <span class="hljs-keyword">const</span> fd = fs.openSync(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;r+&apos;</span>);
  
  <span class="hljs-comment">// &#x5C06;&#x6587;&#x4EF6;&#x622A;&#x65AD;&#x4E3A;&#x524D; 4 &#x4E2A;&#x5B57;&#x8282;&#x3002;</span>
  fs.ftruncate(fd, <span class="hljs-number">4</span>, (err) =&gt; {
    assert.ifError(err);
    <span class="hljs-built_in">console</span>.log(fs.readFileSync(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>));
  });
  <span class="hljs-comment">// &#x6253;&#x5370;: Node</span></code></pre>
  <p>&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5C0F;&#x4E8E; <code>len</code> &#x4E2A;&#x5B57;&#x8282;&#xFF0C;&#x5219;&#x4F1A;&#x5BF9;&#x5176;&#x8FDB;&#x884C;&#x6269;&#x5C55;&#xFF0C;&#x5E76;&#x4E14;&#x6269;&#x5C55;&#x90E8;&#x5206;&#x5C06;&#x586B;&#x5145;&#x7A7A;&#x5B57;&#x8282;&#xFF08;<code>&apos;\0&apos;</code>&#xFF09;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-built_in">console</span>.log(fs.readFileSync(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>));
  <span class="hljs-comment">// &#x6253;&#x5370;: Node.js</span>
  
  <span class="hljs-comment">// &#x83B7;&#x53D6;&#x8981;&#x622A;&#x65AD;&#x7684;&#x6587;&#x4EF6;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</span>
  <span class="hljs-keyword">const</span> fd = fs.openSync(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;r+&apos;</span>);
  
  <span class="hljs-comment">// &#x5C06;&#x6587;&#x4EF6;&#x622A;&#x65AD;&#x4E3A;&#x524D; 10 &#x4E2A;&#x5B57;&#x8282;&#xFF0C;&#x4F46;&#x5B9E;&#x9645;&#x5927;&#x5C0F;&#x4E3A; 7 &#x4E2A;&#x5B57;&#x8282;&#x3002;</span>
  fs.ftruncate(fd, <span class="hljs-number">10</span>, (err) =&gt; {
    assert.ifError(err);
    <span class="hljs-built_in">console</span>.log(fs.readFileSync(<span class="hljs-string">&apos;temp.txt&apos;</span>));
  });
  <span class="hljs-comment">// &#x6253;&#x5370;: &lt;Buffer 4e 6f 64 65 2e 6a 73 00 00 00&gt;</span>
  <span class="hljs-comment">// (UTF8 &#x7684;&#x503C;&#x4E3A; &apos;Node.js\0\0\0&apos;)</span></code></pre>
  <p>&#x6700;&#x540E; 3 &#x4E2A;&#x5B57;&#x8282;&#x662F;&#x7A7A;&#x5B57;&#x8282;&#xFF08;<code>&apos;\0&apos;</code>&#xFF09;&#xFF0C;&#x4EE5;&#x8865;&#x5145;&#x8D85;&#x51FA;&#x7684;&#x622A;&#x65AD;&#x3002;</p>
  <h2><code>fs.ftruncateSync(fd[, len])</code><span><a class="mark" href="#fs_fs_ftruncatesync_fd_len" id="fs_fs_ftruncatesync_fd_len">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_ftruncatesync_fd_len.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_ftruncatesync_fd_len.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.8.6</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>len</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  </ul>
  <p>&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <p>&#x6709;&#x5173;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x89C1;&#x6B64;API&#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/dRb1jt" rel="nofollow"><code>fs.ftruncate()</code></a>&#x3002;</p>
  <h2><code>fs.futimes(fd, atime, mtime, callback)</code><span><a class="mark" href="#fs_fs_futimes_fd_atime_mtime_callback" id="fs_fs_futimes_fd_atime_mtime_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_futimes_fd_atime_mtime_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_futimes_fd_atime_mtime_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v4.1.0</td>
  <td><p>Numeric strings, <code>NaN</code> and <code>Infinity</code> are now allowed time specifiers.</p></td></tr>
  <tr><td>v0.4.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.4.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>atime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li><code>mtime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x6307;&#x5411;&#x7684;&#x5BF9;&#x8C61;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x65F6;&#x95F4;&#x6233;&#x3002;
  &#x53C2;&#x89C1; <a href="/s/UxAPRV" rel="nofollow"><code>fs.utimes()</code></a>&#x3002;</p>
  <p>&#x6B64;&#x51FD;&#x6570;&#x5728; 7.1 &#x4E4B;&#x524D;&#x7684; AIX &#x7248;&#x672C;&#x4E0A;&#x4E0D;&#x8D77;&#x4F5C;&#x7528;&#xFF0C;&#x5B83;&#x5C06;&#x8FD4;&#x56DE; <code>UV_ENOSYS</code> &#x9519;&#x8BEF;&#x3002;</p>
  <h2><code>fs.futimesSync(fd, atime, mtime)</code><span><a class="mark" href="#fs_fs_futimessync_fd_atime_mtime" id="fs_fs_futimessync_fd_atime_mtime">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_futimessync_fd_atime_mtime.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_futimessync_fd_atime_mtime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v4.1.0</td>
  <td><p>Numeric strings, <code>NaN</code> and <code>Infinity</code> are now allowed time specifiers.</p></td></tr>
  <tr><td>v0.4.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.4.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>atime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li><code>mtime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  </ul>
  <p><a href="/s/Pxb3N1" rel="nofollow"><code>fs.futimes()</code></a> &#x7684;&#x540C;&#x6B65;&#x7248;&#x672C;&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.lchmod(path, mode, callback)</code><span><a class="mark" href="#fs_fs_lchmod_path_mode_callback" id="fs_fs_lchmod_path_mode_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_lchmod_path_mode_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_lchmod_path_mode_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.4.7</td>
  <td><p><span>&#x5F03;&#x7528;&#x4E8E;: v0.4.7</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/yC9BxV" rel="nofollow"><code>lchmod(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x4EC5;&#x9002;&#x7528;&#x4E8E; macOS&#x3002;</p>
  <h2><code>fs.lchmodSync(path, mode)</code><span><a class="mark" href="#fs_fs_lchmodsync_path_mode" id="fs_fs_lchmodsync_path_mode">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_lchmodsync_path_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_lchmodsync_path_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x5F03;&#x7528;&#x4E8E;: v0.4.7</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/yC9BxV" rel="nofollow"><code>lchmod(2)</code></a>&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.lchown(path, uid, gid, callback)</code><span><a class="mark" href="#fs_fs_lchown_path_uid_gid_callback" id="fs_fs_lchown_path_uid_gid_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_lchown_path_uid_gid_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_lchown_path_uid_gid_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.6.0</td>
  <td><p>This API is no longer deprecated.</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>uid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>gid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/fGGBXD" rel="nofollow"><code>lchown(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <h2><code>fs.lchownSync(path, uid, gid)</code><span><a class="mark" href="#fs_fs_lchownsync_path_uid_gid" id="fs_fs_lchownsync_path_uid_gid">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_lchownsync_path_uid_gid.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_lchownsync_path_uid_gid.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.6.0</td>
  <td><p>This API is no longer deprecated.</p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>uid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>gid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/fGGBXD" rel="nofollow"><code>lchown(2)</code></a>&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.lutimes(path, atime, mtime, callback)</code><span><a class="mark" href="#fs_fs_lutimes_path_atime_mtime_callback" id="fs_fs_lutimes_path_atime_mtime_callback">#</a></span></h2><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_lutimes_path_atime_mtime_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>atime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li><code>mtime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>Changes the access and modification times of a file in the same way as
  <a href="/s/UxAPRV" rel="nofollow"><code>fs.utimes()</code></a>, with the difference that if the path refers to a symbolic
  link, then the link is not dereferenced: instead, the timestamps of the
  symbolic link itself are changed.</p>
  <p>No arguments other than a possible exception are given to the completion
  callback.</p>
  <h2><code>fs.lutimesSync(path, atime, mtime)</code><span><a class="mark" href="#fs_fs_lutimessync_path_atime_mtime" id="fs_fs_lutimessync_path_atime_mtime">#</a></span></h2><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_lutimessync_path_atime_mtime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.5.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>atime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li><code>mtime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  </ul>
  <p>Change the file system timestamps of the symbolic link referenced by <code>path</code>.
  Returns <code>undefined</code>, or throws an exception when parameters are incorrect or
  the operation fails. This is the synchronous version of <a href="/s/Dv2kJN" rel="nofollow"><code>fs.lutimes()</code></a>.</p>
  <h2><code>fs.link(existingPath, newPath, callback)</code><span><a class="mark" href="#fs_fs_link_existingpath_newpath_callback" id="fs_fs_link_existingpath_newpath_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_link_existingpath_newpath_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_link_existingpath_newpath_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>The <code>existingPath</code> and <code>newPath</code> parameters can be WHATWG <code>URL</code> objects using <code>file:</code> protocol. Support is currently still <em>experimental</em>.</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>existingPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>newPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/U8H1mr" rel="nofollow"><code>link(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <h2><code>fs.linkSync(existingPath, newPath)</code><span><a class="mark" href="#fs_fs_linksync_existingpath_newpath" id="fs_fs_linksync_existingpath_newpath">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_linksync_existingpath_newpath.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_linksync_existingpath_newpath.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>The <code>existingPath</code> and <code>newPath</code> parameters can be WHATWG <code>URL</code> objects using <code>file:</code> protocol. Support is currently still <em>experimental</em>.</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>existingPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>newPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/U8H1mr" rel="nofollow"><code>link(2)</code></a>&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.lstat(path[, options], callback)</code><span><a class="mark" href="#fs_fs_lstat_path_options_callback" id="fs_fs_lstat_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_lstat_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_lstat_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>&#x63A5;&#x53D7;&#x989D;&#x5916;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; bigint&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.1.30</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.30</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x8FD4;&#x56DE;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x5E94;&#x4E3A; <code>bigint</code> &#x578B;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>stats</code> <a href="/s/NMuvVx" target="_blank" rel="nofollow" class="type">&lt;fs.Stats&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/fGaHTu" rel="nofollow"><code>lstat(2)</code></a>&#x3002;
  &#x56DE;&#x8C03;&#x4F1A;&#x4F20;&#x5165;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(err, stats)</code>&#xFF0C;&#x5176;&#x4E2D; <code>stats</code> &#x662F; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x3002;
  <code>lstat()</code> &#x4E0E; <a href="/s/fdrjxj" rel="nofollow"><code>stat()</code></a> &#x76F8;&#x540C;&#xFF0C;&#x53EA;&#x662F;&#x5982;&#x679C; <code>path</code> &#x662F;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#xFF0C;&#x5219;&#x67E5;&#x770B;&#x7684;&#x662F;&#x94FE;&#x63A5;&#x81EA;&#x8EAB;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x5B83;&#x6307;&#x5411;&#x7684;&#x6587;&#x4EF6;&#x3002;</p>
  <h2><code>fs.lstatSync(path[, options])</code><span><a class="mark" href="#fs_fs_lstatsync_path_options" id="fs_fs_lstatsync_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_lstatsync_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_lstatsync_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>&#x63A5;&#x53D7;&#x989D;&#x5916;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; bigint&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.30</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.30</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x8FD4;&#x56DE;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x5E94;&#x4E3A; <code>bigint</code> &#x578B;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/NMuvVx" target="_blank" rel="nofollow" class="type">&lt;fs.Stats&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/fGaHTu" rel="nofollow"><code>lstat(2)</code></a>&#x3002;</p>
  <h2><code>fs.mkdir(path[, options], callback)</code><span><a class="mark" href="#fs_fs_mkdir_path_options_callback" id="fs_fs_mkdir_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_mkdir_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_mkdir_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.11.0</td>
  <td><p>&#x5728; <code>recursive</code> &#x6A21;&#x5F0F;&#x4E2D;&#xFF0C;&#x56DE;&#x8C03;&#x4F1A;&#x63A5;&#x6536;&#x521B;&#x5EFA;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x8DEF;&#x5F84;&#x4F5C;&#x4E3A;&#x53C2;&#x6570;&#x3002;</p></td></tr>
  <tr><td>v10.12.0</td>
  <td><p>&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F; <code>options</code> &#x5BF9;&#x8C61;&#xFF08;&#x5177;&#x6709; <code>recursive</code> &#x548C; <code>mode</code> &#x5C5E;&#x6027;&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.1.8</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.8</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></p>
  <ul>
  <li><code>recursive</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x5728; Windows &#x4E0A;&#x4E0D;&#x652F;&#x6301;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o777</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x521B;&#x5EFA;&#x76EE;&#x5F55;&#x3002;</p>
  <p>&#x56DE;&#x8C03;&#x4F1A;&#x4F20;&#x5165;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#x3001;&#x4EE5;&#x53CA;&#x521B;&#x5EFA;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x76EE;&#x5F55;&#x7684;&#x8DEF;&#x5F84;&#xFF08;&#x5982;&#x679C; <code>recursive</code> &#x4E3A; <code>true</code>&#xFF09;&#xFF0C; <code>(err, [path])</code>&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x6574;&#x6570;&#xFF08;&#x6307;&#x5B9A; <code>mode</code>&#xFF08;&#x6743;&#x9650;&#x548C;&#x7C98;&#x6EDE;&#x4F4D;&#xFF09;&#xFF09;&#x3001;&#x6216;&#x5BF9;&#x8C61;&#xFF08;&#x5177;&#x6709; <code>mode</code> &#x5C5E;&#x6027;&#x548C; <code>recursive</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x793A;&#x662F;&#x5426;&#x8981;&#x521B;&#x5EFA;&#x7236;&#x76EE;&#x5F55;&#xFF09;&#xFF09;&#x3002;
  &#x5F53; <code>path</code> &#x662F;&#x5DF2;&#x5B58;&#x5728;&#x7684;&#x76EE;&#x5F55;&#x65F6;&#xFF0C;&#x8C03;&#x7528; <code>fs.mkdir()</code> &#x4EC5;&#x5728; <code>recursive</code> &#x4E3A; false &#x65F6;&#x624D;&#x4F1A;&#x5BFC;&#x81F4;&#x9519;&#x8BEF;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x521B;&#x5EFA; `/&#x76EE;&#x5F55;1/&#x76EE;&#x5F55;2/&#x76EE;&#x5F55;3`&#xFF0C;&#x4E0D;&#x7BA1; `/&#x76EE;&#x5F55;1` &#x548C; `/&#x76EE;&#x5F55;1/&#x76EE;&#x5F55;2` &#x662F;&#x5426;&#x5B58;&#x5728;&#x3002;</span>
  fs.mkdir(<span class="hljs-string">&apos;/&#x76EE;&#x5F55;1/&#x76EE;&#x5F55;2/&#x76EE;&#x5F55;3&apos;</span>, { <span class="hljs-attr">recursive</span>: <span class="hljs-literal">true</span> }, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
  });</code></pre>
  <p>&#x5728; Windows &#x4E0A;&#xFF0C;&#x5BF9;&#x6839;&#x76EE;&#x5F55;&#x4F7F;&#x7528; <code>fs.mkdir()</code>&#xFF08;&#x5373;&#x4F7F;&#x4F7F;&#x7528;&#x904D;&#x5386;&#xFF09;&#x4E5F;&#x4F1A;&#x5BFC;&#x81F4;&#x9519;&#x8BEF;&#xFF1A;</p>
  <pre><code class="language-js">fs.mkdir(<span class="hljs-string">&apos;/&apos;</span>, { <span class="hljs-attr">recursive</span>: <span class="hljs-literal">true</span> }, (err) =&gt; {
    <span class="hljs-comment">// =&gt; [Error: EPERM: operation not permitted, mkdir &apos;C:\&apos;]</span>
  });</code></pre>
  <p>&#x4E5F;&#x53EF;&#x53C2;&#x89C1; <a href="/s/ebLzdi" rel="nofollow"><code>mkdir(2)</code></a>&#x3002;</p>
  <h2><code>fs.mkdirSync(path[, options])</code><span><a class="mark" href="#fs_fs_mkdirsync_path_options" id="fs_fs_mkdirsync_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_mkdirsync_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_mkdirsync_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.11.0</td>
  <td><p>&#x5728; <code>recursive</code> &#x6A21;&#x5F0F;&#x4E2D;&#xFF0C;&#x4F1A;&#x8FD4;&#x56DE;&#x521B;&#x5EFA;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x8DEF;&#x5F84;&#x3002;</p></td></tr>
  <tr><td>v10.12.0</td>
  <td><p>&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F; <code>options</code> &#x5BF9;&#x8C61;&#xFF08;&#x5177;&#x6709; <code>recursive</code> &#x548C; <code>mode</code> &#x5C5E;&#x6027;&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></p>
  <ul>
  <li><code>recursive</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x5728; Windows &#x4E0A;&#x4E0D;&#x652F;&#x6301;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o777</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/8ym6ow" target="_blank" rel="nofollow" class="type">&lt;undefined&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x5730;&#x521B;&#x5EFA;&#x76EE;&#x5F55;&#x3002;
  &#x8FD4;&#x56DE; <code>undefined</code>&#xFF0C;&#x6216;&#x521B;&#x5EFA;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x76EE;&#x5F55;&#x7684;&#x8DEF;&#x5F84;&#xFF08;&#x5982;&#x679C; <code>recursive</code> &#x4E3A; <code>true</code>&#xFF09;&#x3002;
  &#x8FD9;&#x662F; <a href="/s/Adhmvz" rel="nofollow"><code>fs.mkdir()</code></a> &#x7684;&#x540C;&#x6B65;&#x7248;&#x672C;&#x3002;</p>
  <p>&#x4E5F;&#x53EF;&#x53C2;&#x89C1; <a href="/s/ebLzdi" rel="nofollow"><code>mkdir(2)</code></a>&#x3002;</p>
  <h2><code>fs.mkdtemp(prefix[, options], callback)</code><span><a class="mark" href="#fs_fs_mkdtemp_prefix_options_callback" id="fs_fs_mkdtemp_prefix_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_mkdtemp_prefix_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_mkdtemp_prefix_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v6.2.1</td>
  <td><p>The <code>callback</code> parameter is optional now.</p></td></tr>
  <tr><td>v5.10.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v5.10.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>prefix</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>directory</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x552F;&#x4E00;&#x7684;&#x4E34;&#x65F6;&#x76EE;&#x5F55;&#x3002;</p>
  <p>&#x751F;&#x6210;&#x8981;&#x9644;&#x52A0;&#x5728;&#x5FC5;&#x9700;&#x7684; <code>prefix</code> &#x540E;&#x9762;&#x7684;&#x516D;&#x4F4D;&#x968F;&#x673A;&#x5B57;&#x7B26;&#xFF0C;&#x4EE5;&#x521B;&#x5EFA;&#x552F;&#x4E00;&#x7684;&#x4E34;&#x65F6;&#x76EE;&#x5F55;&#x3002;
  &#x7531;&#x4E8E;&#x5E73;&#x53F0;&#x7684;&#x4E0D;&#x4E00;&#x81F4;&#x6027;&#xFF0C;&#x8BF7;&#x907F;&#x514D;&#x5728; <code>prefix</code> &#x4E2D;&#x4EE5; <code>X</code> &#x5B57;&#x7B26;&#x7ED3;&#x5C3E;&#x3002;
  &#x5728;&#x67D0;&#x4E9B;&#x5E73;&#x53F0;&#x4E0A;&#xFF0C;&#x7279;&#x522B;&#x662F; BSD&#xFF0C;&#x53EF;&#x4EE5;&#x8FD4;&#x56DE;&#x516D;&#x4E2A;&#x4EE5;&#x4E0A;&#x7684;&#x968F;&#x673A;&#x5B57;&#x7B26;&#xFF0C;&#x5E76;&#x7528;&#x968F;&#x673A;&#x5B57;&#x7B26;&#x66FF;&#x6362; <code>prefix</code> &#x4E2D;&#x7ED3;&#x5C3E;&#x7684; <code>X</code> &#x5B57;&#x7B26;&#x3002;</p>
  <p>&#x521B;&#x5EFA;&#x7684;&#x76EE;&#x5F55;&#x8DEF;&#x5F84;&#x4F5C;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x4F20;&#x7ED9;&#x56DE;&#x8C03;&#x7684;&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x5177;&#x6709;&#x6307;&#x5B9A;&#x8981;&#x4F7F;&#x7528;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x7684; <code>encoding</code> &#x5C5E;&#x6027;&#x7684;&#x5BF9;&#x8C61;&#x3002;</p>
  <pre><code class="language-js">fs.mkdtemp(path.join(os.tmpdir(), <span class="hljs-string">&apos;&#x76EE;&#x5F55;-&apos;</span>), (err, directory) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(directory);
    <span class="hljs-comment">// &#x6253;&#x5370;: /tmp/&#x76EE;&#x5F55;-itXde2 &#x6216; C:\Users\...\AppData\Local\Temp\&#x76EE;&#x5F55;-itXde2</span>
  });</code></pre>
  <p><code>fs.mkdtemp()</code> &#x65B9;&#x6CD5;&#x5C06;&#x516D;&#x4F4D;&#x968F;&#x673A;&#x9009;&#x62E9;&#x7684;&#x5B57;&#x7B26;&#x76F4;&#x63A5;&#x9644;&#x52A0;&#x5230; <code>prefix</code> &#x5B57;&#x7B26;&#x4E32;&#x3002;
  &#x4F8B;&#x5982;&#xFF0C;&#x7ED9;&#x5B9A;&#x76EE;&#x5F55; <code>/tmp</code>&#xFF0C;&#x5982;&#x679C;&#x6253;&#x7B97;&#x5728; <code>/tmp</code> &#x4E2D;&#x521B;&#x5EFA;&#x4E34;&#x65F6;&#x76EE;&#x5F55;&#xFF0C;&#x5219; <code>prefix</code> &#x5FC5;&#x987B;&#x5728;&#x5C3E;&#x90E8;&#x52A0;&#x4E0A;&#x7279;&#x5B9A;&#x5E73;&#x53F0;&#x7684;&#x8DEF;&#x5F84;&#x5206;&#x9694;&#x7B26;&#xFF08;<code>require(&apos;path&apos;).sep</code>&#xFF09;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x65B0;&#x7684;&#x4E34;&#x65F6;&#x76EE;&#x5F55;&#x7684;&#x7236;&#x76EE;&#x5F55;&#x3002;</span>
  <span class="hljs-keyword">const</span> tmpDir = os.tmpdir();
  
  <span class="hljs-comment">// &#x6B64;&#x7528;&#x6CD5;&#x662F;&#x9519;&#x8BEF;&#x7684;&#xFF1A;</span>
  fs.mkdtemp(tmpDir, (err, directory) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(directory);
    <span class="hljs-comment">// &#x8F93;&#x51FA;&#x7C7B;&#x4F3C; `/tmpabc123`&#x3002;</span>
    <span class="hljs-comment">// &#x65B0;&#x7684;&#x4E34;&#x65F6;&#x76EE;&#x5F55;&#x4F1A;&#x88AB;&#x521B;&#x5EFA;&#x5728;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x6839;&#x76EE;&#x5F55;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x5728; /tmp &#x76EE;&#x5F55;&#x4E2D;&#x3002;</span>
  });
  
  <span class="hljs-comment">// &#x6B64;&#x7528;&#x6CD5;&#x662F;&#x6B63;&#x786E;&#x7684;&#xFF1A;</span>
  <span class="hljs-keyword">const</span> { sep } = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;path&apos;</span>);
  fs.mkdtemp(<span class="hljs-string">`<span class="hljs-subst">${tmpDir}</span><span class="hljs-subst">${sep}</span>`</span>, (err, directory) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(directory);
    <span class="hljs-comment">// &#x8F93;&#x51FA;&#x7C7B;&#x4F3C; `/tmp/abc123`&#x3002;</span>
    <span class="hljs-comment">// &#x65B0;&#x7684;&#x4E34;&#x65F6;&#x76EE;&#x5F55;&#x4F1A;&#x88AB;&#x521B;&#x5EFA;&#x5728; /tmp &#x76EE;&#x5F55;&#x4E2D;&#x3002;</span>
  });</code></pre>
  <h2><code>fs.mkdtempSync(prefix[, options])</code><span><a class="mark" href="#fs_fs_mkdtempsync_prefix_options" id="fs_fs_mkdtempsync_prefix_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_mkdtempsync_prefix_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_mkdtempsync_prefix_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v5.10.0</span>
  </div>
  <ul>
  <li><code>prefix</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  </ul>
  <p>&#x8FD4;&#x56DE;&#x521B;&#x5EFA;&#x7684;&#x76EE;&#x5F55;&#x8DEF;&#x5F84;&#x3002;</p>
  <p>&#x6709;&#x5173;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x89C1;&#x6B64; API &#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/gPmez5" rel="nofollow"><code>fs.mkdtemp()</code></a>&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x5177;&#x6709;&#x6307;&#x5B9A;&#x8981;&#x4F7F;&#x7528;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x7684; <code>encoding</code> &#x5C5E;&#x6027;&#x7684;&#x5BF9;&#x8C61;&#x3002;</p>
  <h2><code>fs.open(path[, flags[, mode]], callback)</code><span><a class="mark" href="#fs_fs_open_path_flags_mode_callback" id="fs_fs_open_path_flags_mode_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_open_path_flags_mode_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_open_path_flags_mode_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v11.1.0</td>
  <td><p>&#x53C2;&#x6570; <code>flags</code> &#x662F;&#x53EF;&#x9009;&#x7684;&#xFF0C;&#x5E76;&#x4E14;&#x9ED8;&#x8BA4;&#x4E3A; <code>&apos;r&apos;</code>&#x3002;</p></td></tr>
  <tr><td>v9.9.0</td>
  <td><p>&#x652F;&#x6301; <code>as</code> &#x548C; <code>as+</code> &#x6807;&#x5FD7;&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.0.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.0.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>flags</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;r&apos;</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#xFF08;&#x53EF;&#x8BFB;&#x5199;&#xFF09;&#x3002;</li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x3002;
  &#x53C2;&#x89C1; <a href="/s/ss2dGs" rel="nofollow"><code>open(2)</code></a>&#x3002;</p>
  <p><code>mode</code> &#x7528;&#x4E8E;&#x8BBE;&#x7F6E;&#x6587;&#x4EF6;&#x6A21;&#x5F0F;&#xFF08;&#x6743;&#x9650;&#x548C;&#x7C98;&#x6EDE;&#x4F4D;&#xFF09;&#xFF0C;&#x4F46;&#x4EC5;&#x9650;&#x4E8E;&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#x65F6;&#x3002;
  &#x5728; Windows &#x4E0A;&#xFF0C;&#x53EA;&#x80FD;&#x64CD;&#x4F5C;&#x5199;&#x6743;&#x9650;&#xFF0C;&#x53C2;&#x89C1; <a href="/s/6QUJs8" rel="nofollow"><code>fs.chmod()</code></a>&#x3002;</p>
  <p>&#x56DE;&#x8C03;&#x6709;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(err, fd)</code>&#x3002;</p>
  <p>&#x6709;&#x4E9B;&#x5B57;&#x7B26; (<code>&lt; &gt; : &quot; / \ | ? *</code>) &#x5728; Windows &#x4E0A;&#x662F;&#x9884;&#x7559;&#x7684;&#xFF0C;&#x53C2;&#x89C1;<a href="/s/GmL95W" rel="nofollow">&#x547D;&#x540D;&#x6587;&#x4EF6;&#x3001;&#x8DEF;&#x5F84;&#x4EE5;&#x53CA;&#x547D;&#x540D;&#x7A7A;&#x95F4;</a>&#x3002;
  &#x5728; NTFS &#x4E0A;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x540D;&#x5305;&#x542B;&#x5192;&#x53F7;&#xFF0C;&#x5219; Node.js &#x4F1A;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x6D41;&#xFF0C;&#x53C2;&#x89C1;<a href="/s/FY8iKV" rel="nofollow">&#x6B64; MSDN &#x9875;&#x9762;</a>&#x3002;</p>
  <p>&#x57FA;&#x4E8E; <code>fs.open()</code> &#x7684;&#x51FD;&#x6570;&#x4E5F;&#x4F1A;&#x8868;&#x73B0;&#x51FA;&#x4EE5;&#x4E0A;&#x884C;&#x4E3A;&#xFF0C;&#x6BD4;&#x5982; <code>fs.writeFile()</code>&#x3001; <code>fs.readFile()</code> &#x7B49;&#x3002;</p>
  <h2><code>fs.opendir(path[, options], callback)</code><span><a class="mark" href="#fs_fs_opendir_path_options_callback" id="fs_fs_opendir_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_opendir_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_opendir_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.1.0, v12.16.0</td>
  <td><p>The <code>bufferSize</code> option was introduced.</p></td></tr>
  <tr><td>v12.12.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>bufferSize</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x5F53;&#x4ECE;&#x76EE;&#x5F55;&#x8BFB;&#x53D6;&#x65F6;&#x5728;&#x5185;&#x90E8;&#x7F13;&#x51B2;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x7684;&#x6570;&#x91CF;&#x3002;&#x503C;&#x8D8A;&#x9AD8;&#xFF0C;&#x5219;&#x6027;&#x80FD;&#x8D8A;&#x597D;&#xFF0C;&#x4F46;&#x5185;&#x5B58;&#x5360;&#x7528;&#x66F4;&#x9AD8;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>32</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>dir</code> <a href="/s/PrNiRv" target="_blank" rel="nofollow" class="type">&lt;fs.Dir&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x6253;&#x5F00;&#x76EE;&#x5F55;&#x3002; 
  &#x53C2;&#x89C1; <a href="/s/KKZ5fX" rel="nofollow"><code>opendir(3)</code></a>&#x3002;</p>
  <p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A; <a href="/s/PrNiRv" rel="nofollow"><code>fs.Dir</code></a>&#xFF0C;&#x5176;&#x4E2D;&#x5305;&#x542B;&#x6240;&#x6709;&#x7528;&#x4E8E;&#x66F4;&#x8FDB;&#x4E00;&#x6B65;&#x8BFB;&#x53D6;&#x548C;&#x6E05;&#x7406;&#x76EE;&#x5F55;&#x7684;&#x7684;&#x51FD;&#x6570;&#x3002;</p>
  <p><code>encoding</code> &#x9009;&#x9879;&#x7528;&#x4E8E;&#x5728;&#x6253;&#x5F00;&#x76EE;&#x5F55;&#x548C;&#x540E;&#x7EED;&#x7684;&#x8BFB;&#x53D6;&#x64CD;&#x4F5C;&#x65F6;&#x8BBE;&#x7F6E; <code>path</code> &#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <h2><code>fs.opendirSync(path[, options])</code><span><a class="mark" href="#fs_fs_opendirsync_path_options" id="fs_fs_opendirsync_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_opendirsync_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_opendirsync_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.1.0, v12.16.0</td>
  <td><p>The <code>bufferSize</code> option was introduced.</p></td></tr>
  <tr><td>v12.12.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>bufferSize</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x5F53;&#x4ECE;&#x76EE;&#x5F55;&#x8BFB;&#x53D6;&#x65F6;&#x5728;&#x5185;&#x90E8;&#x7F13;&#x51B2;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x7684;&#x6570;&#x91CF;&#x3002;&#x503C;&#x8D8A;&#x9AD8;&#xFF0C;&#x5219;&#x6027;&#x80FD;&#x8D8A;&#x597D;&#xFF0C;&#x4F46;&#x5185;&#x5B58;&#x5360;&#x7528;&#x66F4;&#x9AD8;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>32</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/PrNiRv" target="_blank" rel="nofollow" class="type">&lt;fs.Dir&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x5730;&#x6253;&#x5F00;&#x76EE;&#x5F55;&#x3002; 
  &#x53C2;&#x89C1; <a href="/s/KKZ5fX" rel="nofollow"><code>opendir(3)</code></a>&#x3002;</p>
  <p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A; <a href="/s/PrNiRv" rel="nofollow"><code>fs.Dir</code></a>&#xFF0C;&#x5176;&#x4E2D;&#x5305;&#x542B;&#x6240;&#x6709;&#x7528;&#x4E8E;&#x66F4;&#x8FDB;&#x4E00;&#x6B65;&#x8BFB;&#x53D6;&#x548C;&#x6E05;&#x7406;&#x76EE;&#x5F55;&#x7684;&#x51FD;&#x6570;&#x3002;</p>
  <p><code>encoding</code> &#x9009;&#x9879;&#x7528;&#x4E8E;&#x5728;&#x6253;&#x5F00;&#x76EE;&#x5F55;&#x548C;&#x540E;&#x7EED;&#x7684;&#x8BFB;&#x53D6;&#x64CD;&#x4F5C;&#x65F6;&#x8BBE;&#x7F6E; <code>path</code> &#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <h2><code>fs.openSync(path[, flags, mode])</code><span><a class="mark" href="#fs_fs_opensync_path_flags_mode" id="fs_fs_opensync_path_flags_mode">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_opensync_path_flags_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_opensync_path_flags_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v11.1.0</td>
  <td><p>&#x53C2;&#x6570; <code>flags</code> &#x662F;&#x53EF;&#x9009;&#x7684;&#xFF0C;&#x5E76;&#x4E14;&#x9ED8;&#x8BA4;&#x4E3A; <code>&apos;r&apos;</code>&#x3002;</p></td></tr>
  <tr><td>v9.9.0</td>
  <td><p>&#x652F;&#x6301; <code>as</code> &#x548C; <code>as+</code> &#x6807;&#x5FD7;&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>flags</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;r&apos;</code>&#x3002;&#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;</li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#x3002;</li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a></li>
  </ul>
  <p>&#x8FD4;&#x56DE;&#x8868;&#x793A;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x7684;&#x6574;&#x6570;&#x3002;</p>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/9Q96Bd" rel="nofollow"><code>fs.open()</code></a>&#x3002;</p>
  <h2><code>fs.read(fd, buffer, offset, length, position, callback)</code><span><a class="mark" href="#fs_fs_read_fd_buffer_offset_length_position_callback" id="fs_fs_read_fd_buffer_offset_length_position_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_read_fd_buffer_offset_length_position_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_read_fd_buffer_offset_length_position_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.10.0</td>
  <td><p>&#x53C2;&#x6570; <code>buffer</code> &#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x4F55; <code>TypedArray</code> &#x6216; <code>DataView</code>&#x3002;</p></td></tr>
  <tr><td>v7.4.0</td>
  <td><p>&#x53C2;&#x6570; <code>buffer</code> &#x53EF;&#x4EE5;&#x662F; <code>Uint8Array</code>&#x3002;</p></td></tr>
  <tr><td>v6.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>length</code> &#x53EF;&#x4EE5;&#x4E3A; <code>0</code>&#x3002;</p></td></tr>
  <tr><td>v0.0.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.0.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/oh3CkV" target="_blank" rel="nofollow" class="type">&lt;TypedArray&gt;</a> | <a href="/s/yCdVkD" target="_blank" rel="nofollow" class="type">&lt;DataView&gt;</a></li>
  <li><code>offset</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>length</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>bytesRead</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x4ECE; <code>fd</code> &#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x4E2D;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#x3002;</p>
  <p><code>buffer</code> &#x662F;&#x6570;&#x636E;&#xFF08;&#x4ECE; fd &#x8BFB;&#x53D6;&#xFF09;&#x8981;&#x88AB;&#x5199;&#x5165;&#x7684; buffer&#x3002;</p>
  <p><code>offset</code> &#x662F; buffer &#x4E2D;&#x5F00;&#x59CB;&#x5199;&#x5165;&#x7684;&#x504F;&#x79FB;&#x91CF;&#x3002;</p>
  <p><code>length</code> &#x662F;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x8981;&#x8BFB;&#x53D6;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</p>
  <p><code>position</code> &#x53C2;&#x6570;&#x6307;&#x5B9A;&#x4ECE;&#x6587;&#x4EF6;&#x4E2D;&#x5F00;&#x59CB;&#x8BFB;&#x53D6;&#x7684;&#x4F4D;&#x7F6E;&#x3002;
  &#x5982;&#x679C; <code>position</code> &#x4E3A; <code>null</code>&#xFF0C;&#x5219;&#x4ECE;&#x5F53;&#x524D;&#x6587;&#x4EF6;&#x4F4D;&#x7F6E;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#xFF0C;&#x5E76;&#x66F4;&#x65B0;&#x6587;&#x4EF6;&#x4F4D;&#x7F6E;&#x3002;
  &#x5982;&#x679C; <code>position</code> &#x662F;&#x6574;&#x6570;&#xFF0C;&#x5219;&#x6587;&#x4EF6;&#x4F4D;&#x7F6E;&#x4F1A;&#x4FDD;&#x6301;&#x4E0D;&#x53D8;&#x3002;</p>
  <p>&#x56DE;&#x8C03;&#x6709;&#x4E09;&#x4E2A;&#x53C2;&#x6570; <code>(err, bytesRead, buffer)</code>&#x3002;</p>
  <p>&#x5982;&#x679C;&#x8C03;&#x7528;&#x6B64;&#x65B9;&#x6CD5;&#x7684; <a href="/s/DGMNHh" rel="nofollow"><code>util.promisify()</code></a> &#x7248;&#x672C;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>Promise</code>&#xFF08;&#x4F1A;&#x4F20;&#x5165;&#x5177;&#x6709; <code>bytesRead</code> &#x5C5E;&#x6027;&#x548C; <code>buffer</code> &#x5C5E;&#x6027;&#x7684; <code>Object</code>&#xFF09;&#x3002;</p>
  <h2><code>fs.read(fd, [options,] callback)</code><span><a class="mark" href="#fs_fs_read_fd_options_callback" id="fs_fs_read_fd_options_callback">#</a></span></h2><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_read_fd_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.11.0</td>
  <td><p>Options object can be passed in to make Buffer, offset, length and position optional</p></td></tr>
  <tr><td>v13.11.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v13.11.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/oh3CkV" target="_blank" rel="nofollow" class="type">&lt;TypedArray&gt;</a> | <a href="/s/yCdVkD" target="_blank" rel="nofollow" class="type">&lt;DataView&gt;</a> <strong>Default:</strong> <code>Buffer.alloc(16384)</code></li>
  <li><code>offset</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>Default:</strong> <code>0</code></li>
  <li><code>length</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>Default:</strong> <code>buffer.length</code></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>Default:</strong> <code>null</code></li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>bytesRead</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>Similar to the above <code>fs.read</code> function, this version takes an optional <code>options</code> object.
  If no <code>options</code> object is specified, it will default with the above values.</p>
  <h2><code>fs.readdir(path[, options], callback)</code><span><a class="mark" href="#fs_fs_readdir_path_options_callback" id="fs_fs_readdir_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_readdir_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readdir_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.10.0</td>
  <td><p>&#x6DFB;&#x52A0;&#x65B0;&#x7684;&#x9009;&#x9879; <code>withFileTypes</code>&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v6.0.0</td>
  <td><p>&#x6DFB;&#x52A0; <code>options</code> &#x53C2;&#x6570;&#x3002;</p></td></tr>
  <tr><td>v0.1.8</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.8</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>withFileTypes</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>files</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string[]&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer[]&gt;</a> | <a href="/s/mNLVJ7" target="_blank" rel="nofollow" class="type">&lt;fs.Dirent[]&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/QvrbKw" rel="nofollow"><code>readdir(3)</code></a>&#x3002;
  &#x8BFB;&#x53D6;&#x76EE;&#x5F55;&#x7684;&#x5185;&#x5BB9;&#x3002;
  &#x56DE;&#x8C03;&#x6709;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(err, files)</code>&#xFF0C;&#x5176;&#x4E2D; <code>files</code> &#x662F;&#x76EE;&#x5F55;&#x4E2D;&#x6587;&#x4EF6;&#x7684;&#x540D;&#x79F0;&#x7684;&#x6570;&#x7EC4;&#xFF08;&#x4E0D;&#x5305;&#x62EC; <code>&apos;.&apos;</code> &#x548C; <code>&apos;..&apos;</code>&#xFF09;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x4F20;&#x7ED9;&#x56DE;&#x8C03;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options.withFileTypes</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>true</code>&#xFF0C;&#x5219; <code>files</code> &#x6570;&#x7EC4;&#x4F1A;&#x5305;&#x542B; <a href="/s/mNLVJ7" rel="nofollow"><code>fs.Dirent</code></a> &#x5BF9;&#x8C61;&#x3002;</p>
  <h2><code>fs.readdirSync(path[, options])</code><span><a class="mark" href="#fs_fs_readdirsync_path_options" id="fs_fs_readdirsync_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_readdirsync_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readdirsync_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.10.0</td>
  <td><p>&#x6DFB;&#x52A0;&#x65B0;&#x7684;&#x9009;&#x9879; <code>withFileTypes</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>withFileTypes</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string[]&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer[]&gt;</a> | <a href="/s/mNLVJ7" target="_blank" rel="nofollow" class="type">&lt;fs.Dirent[]&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/QvrbKw" rel="nofollow"><code>readdir(3)</code></a>&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x8FD4;&#x56DE;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options.withFileTypes</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x7ED3;&#x679C;&#x4F1A;&#x5305;&#x542B; <a href="/s/mNLVJ7" rel="nofollow"><code>fs.Dirent</code></a> &#x5BF9;&#x8C61;&#x3002;</p>
  <h2><code>fs.readFile(path[, options], callback)</code><span><a class="mark" href="#fs_fs_readfile_path_options_callback" id="fs_fs_readfile_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_readfile_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readfile_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v5.1.0</td>
  <td><p>&#x5982;&#x679C;&#x6210;&#x529F;&#xFF0C;&#x5219; <code>callback</code> &#x88AB;&#x8C03;&#x7528;&#x65F6;&#xFF0C; <code>error</code> &#x53C2;&#x6570;&#x59CB;&#x7EC8;&#x4E3A; <code>null</code>&#x3002;</p></td></tr>
  <tr><td>v5.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</p></td></tr>
  <tr><td>v0.1.29</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.29</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x6587;&#x4EF6;&#x540D;&#x6216;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>null</code>&#x3002;</li>
  <li><code>flag</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;r&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>data</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x8BFB;&#x53D6;&#x6587;&#x4EF6;&#x7684;&#x5168;&#x90E8;&#x5185;&#x5BB9;&#x3002;</p>
  <pre><code class="language-js">fs.readFile(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&#x540D;&apos;</span>, (err, data) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(data);
  });</code></pre>
  <p>&#x56DE;&#x8C03;&#x4F1A;&#x4F20;&#x5165;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(err, data)</code>&#xFF0C;&#x5176;&#x4E2D; <code>data</code> &#x662F;&#x6587;&#x4EF6;&#x7684;&#x5185;&#x5BB9;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x539F;&#x59CB;&#x7684; buffer&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF1A;</p>
  <pre><code class="language-js">fs.readFile(<span class="hljs-string">&apos;/etc/passwd&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>, callback);</code></pre>
  <p>&#x5F53;&#x8DEF;&#x5F84;&#x662F;&#x76EE;&#x5F55;&#x65F6;&#xFF0C;&#x5219; <code>fs.readFile()</code> &#x548C; <a href="/s/LxKo1q" rel="nofollow"><code>fs.readFileSync()</code></a> &#x7684;&#x884C;&#x4E3A;&#x662F;&#x7279;&#x5B9A;&#x4E8E;&#x5E73;&#x53F0;&#x7684;&#x3002;
  &#x5728; macOS&#x3001;Linux &#x548C; Windows &#x4E0A;&#xFF0C;&#x4F1A;&#x8FD4;&#x56DE;&#x9519;&#x8BEF;&#x3002;
  &#x5728; FreeBSD &#x4E0A;&#xFF0C;&#x4F1A;&#x8FD4;&#x56DE;&#x76EE;&#x5F55;&#x5185;&#x5BB9;&#x7684;&#x8868;&#x793A;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x5728; macOS&#x3001;Linux &#x548C; Windows &#x4E0A;&#xFF1A;</span>
  fs.readFile(<span class="hljs-string">&apos;&lt;&#x76EE;&#x5F55;&gt;&apos;</span>, (err, data) =&gt; {
    <span class="hljs-comment">// =&gt; [Error: EISDIR: illegal operation on a directory, read &lt;&#x76EE;&#x5F55;&gt;]</span>
  });
  
  <span class="hljs-comment">// &#x5728; FreeBSD &#x4E0A;&#xFF1A;</span>
  fs.readFile(<span class="hljs-string">&apos;&lt;&#x76EE;&#x5F55;&gt;&apos;</span>, (err, data) =&gt; {
    <span class="hljs-comment">// =&gt; null, &lt;data&gt;</span>
  });</code></pre>
  <p><code>fs.readFile()</code> &#x51FD;&#x6570;&#x4F1A;&#x7F13;&#x51B2;&#x6574;&#x4E2A;&#x6587;&#x4EF6;&#x3002;
  &#x82E5;&#x8981;&#x6700;&#x5C0F;&#x5316;&#x5185;&#x5B58;&#x6210;&#x672C;&#xFF0C;&#x5219;&#x5C3D;&#x53EF;&#x80FD;&#x9009;&#x62E9;&#x6D41;&#x5F0F;&#xFF08;&#x4F7F;&#x7528; <code>fs.createReadStream()</code>&#xFF09;&#x3002;</p>
  <h3>&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;<span><a class="mark" href="#fs_file_descriptors_1" id="fs_file_descriptors_1">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/file_descriptors_1.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_descriptors_1.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <ol>
  <li>&#x4EFB;&#x4F55;&#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x90FD;&#x5FC5;&#x987B;&#x652F;&#x6301;&#x8BFB;&#x53D6;&#x3002;</li>
  <li>&#x5982;&#x679C;&#x5C06;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x6307;&#x5B9A;&#x4E3A; <code>path</code>&#xFF0C;&#x5219;&#x4E0D;&#x4F1A;&#x81EA;&#x52A8;&#x5173;&#x95ED;&#x5B83;&#x3002;</li>
  <li>&#x8BFB;&#x6570;&#x5C06;&#x4ECE;&#x5F53;&#x524D;&#x4F4D;&#x7F6E;&#x5F00;&#x59CB;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5DF2;&#x7ECF;&#x6709;&#x5185;&#x5BB9; <code>&apos;Hello World</code>&apos; &#x5E76;&#x4E14;&#x4F7F;&#x7528;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x8BFB;&#x53D6;&#x4E86;&#x516D;&#x4E2A;&#x5B57;&#x8282;&#xFF0C;&#x5219;&#x4F7F;&#x7528;&#x76F8;&#x540C;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x8C03;&#x7528; <code>fs.readFile()</code> &#x5C06;&#x8FD4;&#x56DE; <code>&apos;World&apos;</code> &#x800C;&#x4E0D;&#x662F; <code>&apos;Hello World&apos;</code>&#x3002;</li>
  </ol>
  <h2><code>fs.readFileSync(path[, options])</code><span><a class="mark" href="#fs_fs_readfilesync_path_options" id="fs_fs_readfilesync_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_readfilesync_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readfilesync_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v5.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</p></td></tr>
  <tr><td>v0.1.8</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.8</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x6587;&#x4EF6;&#x540D;&#x6216;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>null</code>&#x3002;</li>
  <li><code>flag</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;r&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  <p>&#x8FD4;&#x56DE; <code>path</code> &#x7684;&#x5185;&#x5BB9;&#x3002;</p>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/V4cCDF" rel="nofollow"><code>fs.readFile()</code></a>&#x3002;</p>
  <p>&#x5982;&#x679C;&#x6307;&#x5B9A;&#x4E86; <code>encoding</code> &#x9009;&#x9879;&#xFF0C;&#x5219;&#x6B64;&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x5B57;&#x7B26;&#x4E32;&#x3002;
  &#x5426;&#x5219;&#xFF0C;&#x8FD4;&#x56DE; buffer&#x3002;</p>
  <p>&#x4E0E; <a href="/s/V4cCDF" rel="nofollow"><code>fs.readFile()</code></a> &#x76F8;&#x4F3C;&#xFF0C;&#x5F53;&#x8DEF;&#x5F84;&#x662F;&#x76EE;&#x5F55;&#x65F6;&#xFF0C; <code>fs.readFileSync()</code> &#x7684;&#x884C;&#x4E3A;&#x662F;&#x7279;&#x5B9A;&#x4E8E;&#x5E73;&#x53F0;&#x7684;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x5728; macOS&#x3001;Linux &#x548C; Windows &#x4E0A;&#xFF1A;</span>
  fs.readFileSync(<span class="hljs-string">&apos;&lt;&#x76EE;&#x5F55;&gt;&apos;</span>);
  <span class="hljs-comment">// =&gt; [Error: EISDIR: illegal operation on a directory, read &lt;&#x76EE;&#x5F55;&gt;]</span>
  
  <span class="hljs-comment">// &#x5728; FreeBSD &#x4E0A;&#xFF1A;</span>
  fs.readFileSync(<span class="hljs-string">&apos;&lt;&#x76EE;&#x5F55;&gt;&apos;</span>); <span class="hljs-comment">// =&gt; &lt;data&gt;</span></code></pre>
  <h2><code>fs.readlink(path[, options], callback)</code><span><a class="mark" href="#fs_fs_readlink_path_options_callback" id="fs_fs_readlink_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_readlink_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readlink_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>linkString</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/CFw99K" rel="nofollow"><code>readlink(2)</code></a>&#x3002;
  &#x56DE;&#x8C03;&#x4F1A;&#x4F20;&#x5165;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(err, linkString)</code>&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x4F20;&#x7ED9;&#x56DE;&#x8C03;&#x7684;&#x94FE;&#x63A5;&#x8DEF;&#x5F84;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x94FE;&#x63A5;&#x8DEF;&#x5F84;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <h2><code>fs.readlinkSync(path[, options])</code><span><a class="mark" href="#fs_fs_readlinksync_path_options" id="fs_fs_readlinksync_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_readlinksync_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readlinksync_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/CFw99K" rel="nofollow"><code>readlink(2)</code></a>&#x3002;
  &#x8FD4;&#x56DE;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x503C;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x8FD4;&#x56DE;&#x7684;&#x94FE;&#x63A5;&#x8DEF;&#x5F84;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x94FE;&#x63A5;&#x8DEF;&#x5F84;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <h2><code>fs.readSync(fd, buffer, offset, length, position)</code><span><a class="mark" href="#fs_fs_readsync_fd_buffer_offset_length_position" id="fs_fs_readsync_fd_buffer_offset_length_position">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_readsync_fd_buffer_offset_length_position.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readsync_fd_buffer_offset_length_position.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.10.0</td>
  <td><p>&#x53C2;&#x6570; <code>buffer</code> &#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x4F55; <code>TypedArray</code> &#x6216; <code>DataView</code>&#x3002;</p></td></tr>
  <tr><td>v6.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>length</code> &#x53EF;&#x4EE5;&#x4E3A; <code>0</code>&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/oh3CkV" target="_blank" rel="nofollow" class="type">&lt;TypedArray&gt;</a> | <a href="/s/yCdVkD" target="_blank" rel="nofollow" class="type">&lt;DataView&gt;</a></li>
  <li><code>offset</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>length</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a></li>
  </ul>
  <p>&#x8FD4;&#x56DE; <code>bytesRead</code> &#x7684;&#x6570;&#x91CF;&#x3002;</p>
  <p>&#x6709;&#x5173;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x89C1;&#x6B64; API &#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/XF12iY" rel="nofollow"><code>fs.read()</code></a>&#x3002;</p>
  <h2><code>fs.readSync(fd, buffer, [options])</code><span><a class="mark" href="#fs_fs_readsync_fd_buffer_options" id="fs_fs_readsync_fd_buffer_options">#</a></span></h2><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readsync_fd_buffer_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>Options object can be passed in to make offset, length and position optional</p></td></tr>
  <tr><td>v14.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v14.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/oh3CkV" target="_blank" rel="nofollow" class="type">&lt;TypedArray&gt;</a> | <a href="/s/yCdVkD" target="_blank" rel="nofollow" class="type">&lt;DataView&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>offset</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>Default:</strong> <code>0</code></li>
  <li><code>length</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>Default:</strong> <code>buffer.length</code></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>Default:</strong> <code>null</code></li>
  </ul>
  </li>
  <li>Returns: <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a></li>
  </ul>
  <p>Returns the number of <code>bytesRead</code>.</p>
  <p>Similar to the above <code>fs.readSync</code> function, this version takes an optional <code>options</code> object.
  If no <code>options</code> object is specified, it will default with the above values.</p>
  <p>For detailed information, see the documentation of the asynchronous version of
  this API: <a href="/s/XF12iY" rel="nofollow"><code>fs.read()</code></a>.</p>
  <h2><code>fs.readv(fd, buffers[, position], callback)</code><span><a class="mark" href="#fs_fs_readv_fd_buffers_position_callback" id="fs_fs_readv_fd_buffers_position_callback">#</a></span></h2><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readv_fd_buffers_position_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.0.0</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffers</code> <a href="/s/qijt55" target="_blank" rel="nofollow" class="type">&lt;ArrayBufferView[]&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>bytesRead</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffers</code> <a href="/s/qijt55" target="_blank" rel="nofollow" class="type">&lt;ArrayBufferView[]&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>Read from a file specified by <code>fd</code> and write to an array of <code>ArrayBufferView</code>s
  using <code>readv()</code>.</p>
  <p><code>position</code> is the offset from the beginning of the file from where data
  should be read. If <code>typeof position !== &apos;number&apos;</code>, the data will be read
  from the current position.</p>
  <p>The callback will be given three arguments: <code>err</code>, <code>bytesRead</code>, and
  <code>buffers</code>. <code>bytesRead</code> is how many bytes were read from the file.</p>
  <p>If this method is invoked as its <a href="/s/DGMNHh" rel="nofollow"><code>util.promisify()</code></a>ed version, it returns
  a <code>Promise</code> for an <code>Object</code> with <code>bytesRead</code> and <code>buffers</code> properties.</p>
  <h2><code>fs.readvSync(fd, buffers[, position])</code><span><a class="mark" href="#fs_fs_readvsync_fd_buffers_position" id="fs_fs_readvsync_fd_buffers_position">#</a></span></h2><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_readvsync_fd_buffers_position.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.0.0</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffers</code> <a href="/s/qijt55" target="_blank" rel="nofollow" class="type">&lt;ArrayBufferView[]&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>Returns: <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> The number of bytes read.</li>
  </ul>
  <p>For detailed information, see the documentation of the asynchronous version of
  this API: <a href="/s/7csSVz" rel="nofollow"><code>fs.readv()</code></a>.</p>
  <h2><code>fs.realpath(path[, options], callback)</code><span><a class="mark" href="#fs_fs_realpath_path_options_callback" id="fs_fs_realpath_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_realpath_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_realpath_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v8.0.0</td>
  <td><p>Pipe/Socket resolve support was added.</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v6.4.0</td>
  <td><p>Calling <code>realpath</code> now works again for various edge cases on Windows.</p></td></tr>
  <tr><td>v6.0.0</td>
  <td><p>The <code>cache</code> parameter was removed.</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>resolvedPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x901A;&#x8FC7;&#x89E3;&#x6790; <code>.</code>&#x3001; <code>..</code> &#x548C;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#x5F02;&#x6B65;&#x5730;&#x8BA1;&#x7B97;&#x89C4;&#x8303;&#x8DEF;&#x5F84;&#x540D;&#x3002;</p>
  <p>&#x89C4;&#x8303;&#x8DEF;&#x5F84;&#x540D;&#x4E0D;&#x4E00;&#x5B9A;&#x662F;&#x552F;&#x4E00;&#x7684;&#x3002;
  &#x786C;&#x94FE;&#x63A5;&#x548C;&#x7ED1;&#x5B9A;&#x88C5;&#x8F7D;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BB8;&#x591A;&#x8DEF;&#x5F84;&#x540D;&#x66B4;&#x9732;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x5B9E;&#x4F53;&#x3002;</p>
  <p>&#x6B64;&#x51FD;&#x6570;&#x7684;&#x884C;&#x4E3A;&#x7C7B;&#x4F3C;&#x4E8E; <a href="/s/k8V6gK" rel="nofollow"><code>realpath(3)</code></a>&#xFF0C;&#x4F46;&#x6709;&#x4E00;&#x4E9B;&#x4F8B;&#x5916;</p>
  <ol>
  <li>
  <p>&#x5728;&#x4E0D;&#x533A;&#x5206;&#x5927;&#x5C0F;&#x5199;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x4E0A;&#x4E0D;&#x6267;&#x884C;&#x5927;&#x5C0F;&#x5199;&#x8F6C;&#x6362;&#x3002;&#x3002;</p>
  </li>
  <li>
  <p>&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#x7684;&#x6700;&#x5927;&#x6570;&#x91CF;&#x4E0E;&#x5E73;&#x53F0;&#x65E0;&#x5173;&#xFF0C;&#x5E76;&#x4E14;&#x901A;&#x5E38;&#x9AD8;&#x4E8E;&#x672C;&#x5730; <a href="/s/k8V6gK" rel="nofollow"><code>realpath(3)</code></a> &#x5B9E;&#x73B0;&#x652F;&#x6301;&#x7684;&#x6570;&#x91CF;&#x3002;</p>
  </li>
  </ol>
  <p><code>callback</code> &#x6709;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(err, resolvedPath)</code>&#x3002;
  &#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>process.cwd</code> &#x6765;&#x89E3;&#x6790;&#x76F8;&#x5BF9;&#x8DEF;&#x5F84;&#x3002;</p>
  <p>&#x4EC5;&#x652F;&#x6301;&#x53EF;&#x8F6C;&#x6362;&#x4E3A; UTF8 &#x5B57;&#x7B26;&#x4E32;&#x7684;&#x8DEF;&#x5F84;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x4F20;&#x7ED9;&#x56DE;&#x8C03;&#x7684;&#x8DEF;&#x5F84;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x8DEF;&#x5F84;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>path</code> &#x89E3;&#x6790;&#x4E3A;&#x5957;&#x63A5;&#x5B57;&#x6216;&#x7BA1;&#x9053;&#xFF0C;&#x5219;&#x8BE5;&#x51FD;&#x6570;&#x5C06;&#x8FD4;&#x56DE;&#x8BE5;&#x5BF9;&#x8C61;&#x7684;&#x7CFB;&#x7EDF;&#x76F8;&#x5173;&#x540D;&#x79F0;&#x3002;</p>
  <h2><code>fs.realpath.native(path[, options], callback)</code><span><a class="mark" href="#fs_fs_realpath_native_path_options_callback" id="fs_fs_realpath_native_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_realpath_native_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_realpath_native_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v9.2.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>resolvedPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/k8V6gK" rel="nofollow"><code>realpath(3)</code></a>&#x3002;</p>
  <p><code>callback</code> &#x6709;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(err, resolvedPath)</code>&#x3002;</p>
  <p>&#x4EC5;&#x652F;&#x6301;&#x53EF;&#x8F6C;&#x6362;&#x4E3A; UTF8 &#x5B57;&#x7B26;&#x4E32;&#x7684;&#x8DEF;&#x5F84;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x4F20;&#x7ED9;&#x56DE;&#x8C03;&#x7684;&#x8DEF;&#x5F84;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x8DEF;&#x5F84;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53; Node.js &#x4E0E; musl libc &#x94FE;&#x63A5;&#x65F6;&#xFF0C;procfs &#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x5FC5;&#x987B;&#x6302;&#x8F7D;&#x5728; <code>/proc</code> &#x4E0A;&#x624D;&#x80FD;&#x4F7F;&#x6B64;&#x529F;&#x80FD;&#x6B63;&#x5E38;&#x5DE5;&#x4F5C;&#x3002;
  Glibc &#x6CA1;&#x6709;&#x8FD9;&#x4E2A;&#x9650;&#x5236;&#x3002;</p>
  <h2><code>fs.realpathSync(path[, options])</code><span><a class="mark" href="#fs_fs_realpathsync_path_options" id="fs_fs_realpathsync_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_realpathsync_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_realpathsync_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v8.0.0</td>
  <td><p>Pipe/Socket resolve support was added.</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v6.4.0</td>
  <td><p>Calling <code>realpathSync</code> now works again for various edge cases on Windows.</p></td></tr>
  <tr><td>v6.0.0</td>
  <td><p>The <code>cache</code> parameter was removed.</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  <p>&#x8FD4;&#x56DE;&#x5DF2;&#x89E3;&#x6790;&#x7684;&#x8DEF;&#x5F84;&#x540D;&#x3002;</p>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/ML4Vqb" rel="nofollow"><code>fs.realpath()</code></a>&#x3002;</p>
  <h2><code>fs.realpathSync.native(path[, options])</code><span><a class="mark" href="#fs_fs_realpathsync_native_path_options" id="fs_fs_realpathsync_native_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_realpathsync_native_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_realpathsync_native_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v9.2.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>Returns: <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/k8V6gK" rel="nofollow"><code>realpath(3)</code></a>&#x3002;</p>
  <p>&#x4EC5;&#x652F;&#x6301;&#x53EF;&#x8F6C;&#x6362;&#x4E3A; UTF8 &#x5B57;&#x7B26;&#x4E32;&#x7684;&#x8DEF;&#x5F84;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x8FD4;&#x56DE;&#x7684;&#x8DEF;&#x5F84;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x8DEF;&#x5F84;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53; Node.js &#x4E0E; musl libc &#x94FE;&#x63A5;&#x65F6;&#xFF0C;procfs &#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x5FC5;&#x987B;&#x6302;&#x8F7D;&#x5728; <code>/proc</code> &#x4E0A;&#x624D;&#x80FD;&#x4F7F;&#x6B64;&#x529F;&#x80FD;&#x6B63;&#x5E38;&#x5DE5;&#x4F5C;&#x3002;
  Glibc &#x6CA1;&#x6709;&#x8FD9;&#x4E2A;&#x9650;&#x5236;&#x3002;</p>
  <h2><code>fs.rename(oldPath, newPath, callback)</code><span><a class="mark" href="#fs_fs_rename_oldpath_newpath_callback" id="fs_fs_rename_oldpath_newpath_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_rename_oldpath_newpath_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_rename_oldpath_newpath_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>oldPath</code> &#x548C; <code>newPath</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.0.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.0.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>oldPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>newPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x628A; <code>oldPath</code> &#x6587;&#x4EF6;&#x91CD;&#x547D;&#x540D;&#x4E3A; <code>newPath</code> &#x63D0;&#x4F9B;&#x7684;&#x8DEF;&#x5F84;&#x540D;&#x3002;
  &#x5982;&#x679C; <code>newPath</code> &#x5DF2;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x8986;&#x76D6;&#x5B83;&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x4E5F;&#x53EF;&#x53C2;&#x89C1; <a href="/s/YbqghQ" rel="nofollow"><code>rename(2)</code></a>&#x3002;</p>
  <pre><code class="language-js">fs.rename(<span class="hljs-string">&apos;&#x65E7;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x65B0;&#x6587;&#x4EF6;.txt&apos;</span>, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x91CD;&#x547D;&#x540D;&#x5B8C;&#x6210;&apos;</span>);
  });</code></pre>
  <h2><code>fs.renameSync(oldPath, newPath)</code><span><a class="mark" href="#fs_fs_renamesync_oldpath_newpath" id="fs_fs_renamesync_oldpath_newpath">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_renamesync_oldpath_newpath.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_renamesync_oldpath_newpath.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>oldPath</code> &#x548C; <code>newPath</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>oldPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>newPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/YbqghQ" rel="nofollow"><code>rename(2)</code></a>&#x3002;&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.rmdir(path[, options], callback)</code><span><a class="mark" href="#fs_fs_rmdir_path_options_callback" id="fs_fs_rmdir_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_rmdir_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_rmdir_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.3.0, v12.16.0</td>
  <td><p>&#x9009;&#x9879; <code>maxBusyTries</code> &#x88AB;&#x91CD;&#x547D;&#x540D;&#x4E3A; <code>maxRetries</code>&#xFF0C;&#x5E76;&#x4E14;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A; 0&#x3002; <code>emfileWait</code> &#x9009;&#x9879;&#x5DF2;&#x88AB;&#x5220;&#x9664;&#xFF0C;&#x5E76;&#x4E14; <code>EMFILE</code> &#x9519;&#x8BEF;&#x4F7F;&#x7528;&#x4E0E;&#x5176;&#x4ED6;&#x9519;&#x8BEF;&#x76F8;&#x540C;&#x7684;&#x91CD;&#x8BD5;&#x903B;&#x8F91;&#x3002; &#x652F;&#x6301; <code>retryDelay</code> &#x9009;&#x9879;&#x3002; <code>ENFILE</code> &#x9519;&#x8BEF;&#x4F1A;&#x88AB;&#x91CD;&#x8BD5;&#x3002;</p></td></tr>
  <tr><td>v12.10.0</td>
  <td><p>&#x652F;&#x6301; <code>recursive</code>&#x3001; <code>maxBusyTries</code> &#x548C; <code>emfileWait</code> &#x9009;&#x9879;&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.0.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.0.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <p></p><div class="api_stability api_stability_1"><a target="_blank" rel="nofollow" href="/api/documentation.html#documentation_stability_index">&#x7A33;&#x5B9A;&#x6027;: 1</a> - &#x9012;&#x5F52;&#x7684;&#x5220;&#x9664;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</div><p></p>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>maxRetries</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x5982;&#x679C;&#x9047;&#x5230; <code>EBUSY</code>&#x3001; <code>EMFILE</code>&#x3001; <code>ENFILE</code>&#x3001; <code>ENOTEMPTY</code> &#x6216; <code>EPERM</code> &#x9519;&#x8BEF;&#xFF0C;&#x5219; Node.js &#x4F1A;&#x91CD;&#x8BD5;&#x8BE5;&#x64CD;&#x4F5C;&#xFF08;&#x6BCF;&#x6B21;&#x5C1D;&#x8BD5;&#x65F6;&#x4F7F;&#x7528; <code>retryDelay</code> &#x6BEB;&#x79D2;&#x65F6;&#x957F;&#x7684;&#x7EBF;&#x6027;&#x56DE;&#x9000;&#x7B49;&#x5F85;&#xFF09;&#x3002;
  &#x6B64;&#x9009;&#x9879;&#x8868;&#x793A;&#x91CD;&#x8BD5;&#x7684;&#x6B21;&#x6570;&#x3002;
  &#x5982;&#x679C; <code>recursive</code> &#x9009;&#x9879;&#x4E0D;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x6B64;&#x9009;&#x9879;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  <li><code>recursive</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x5982;&#x679C;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x6267;&#x884C;&#x9012;&#x5F52;&#x7684;&#x76EE;&#x5F55;&#x5220;&#x9664;&#x3002;
  &#x5728;&#x9012;&#x5F52;&#x6A21;&#x5F0F;&#x4E2D;&#xFF0C;&#x9519;&#x8BEF;&#x4E0D;&#x4F1A;&#x88AB;&#x62A5;&#x544A;&#xFF08;&#x5982;&#x679C; <code>path</code> &#x4E0D;&#x5B58;&#x5728;&#xFF09;&#xFF0C;&#x5E76;&#x4E14;&#x64CD;&#x4F5C;&#x4F1A;&#x88AB;&#x91CD;&#x8BD5;&#xFF08;&#x5F53;&#x5931;&#x8D25;&#x65F6;&#xFF09;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>retryDelay</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x91CD;&#x8BD5;&#x4E4B;&#x95F4;&#x7B49;&#x5F85;&#x7684;&#x65F6;&#x95F4;&#xFF08;&#x4EE5;&#x6BEB;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#xFF09;&#x3002;
  &#x5982;&#x679C; <code>recursive</code> &#x9009;&#x9879;&#x4E0D;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x6B64;&#x9009;&#x9879;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>100</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/BuUYuq" rel="nofollow"><code>rmdir(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x5BF9;&#x6587;&#x4EF6;&#xFF08;&#x800C;&#x4E0D;&#x662F;&#x76EE;&#x5F55;&#xFF09;&#x4F7F;&#x7528; <code>fs.rmdir()</code> &#x4F1A;&#x5BFC;&#x81F4; <code>ENOENT</code> &#x9519;&#x8BEF;&#xFF08;&#x5728; Windows &#x4E0A;&#xFF09;&#x6216; <code>ENOTDIR</code> &#x9519;&#x8BEF;&#xFF08;&#x5728; POSIX &#x4E0A;&#xFF09;&#x3002;</p>
  <h2><code>fs.rmdirSync(path[, options])</code><span><a class="mark" href="#fs_fs_rmdirsync_path_options" id="fs_fs_rmdirsync_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_rmdirsync_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_rmdirsync_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.3.0, v12.16.0</td>
  <td><p>&#x9009;&#x9879; <code>maxBusyTries</code> &#x88AB;&#x91CD;&#x547D;&#x540D;&#x4E3A; <code>maxRetries</code>&#xFF0C;&#x5E76;&#x4E14;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A; 0&#x3002; <code>emfileWait</code> &#x9009;&#x9879;&#x5DF2;&#x88AB;&#x5220;&#x9664;&#xFF0C;&#x5E76;&#x4E14; <code>EMFILE</code> &#x9519;&#x8BEF;&#x4F7F;&#x7528;&#x4E0E;&#x5176;&#x4ED6;&#x9519;&#x8BEF;&#x76F8;&#x540C;&#x7684;&#x91CD;&#x8BD5;&#x903B;&#x8F91;&#x3002; &#x652F;&#x6301; <code>retryDelay</code> &#x9009;&#x9879;&#x3002; <code>ENFILE</code> &#x9519;&#x8BEF;&#x4F1A;&#x88AB;&#x91CD;&#x8BD5;&#x3002;</p></td></tr>
  <tr><td>v12.10.0</td>
  <td><p>&#x652F;&#x6301; <code>recursive</code>&#x3001; <code>maxBusyTries</code> &#x548C; <code>emfileWait</code> &#x9009;&#x9879;&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <p></p><div class="api_stability api_stability_1"><a target="_blank" rel="nofollow" href="/api/documentation.html#documentation_stability_index">&#x7A33;&#x5B9A;&#x6027;: 1</a> - &#x9012;&#x5F52;&#x7684;&#x5220;&#x9664;&#x662F;&#x5B9E;&#x9A8C;&#x6027;&#x7684;&#x3002;</div><p></p>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>maxRetries</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x5982;&#x679C;&#x9047;&#x5230; <code>EBUSY</code>&#x3001; <code>EMFILE</code>&#x3001; <code>ENFILE</code>&#x3001; <code>ENOTEMPTY</code> &#x6216; <code>EPERM</code> &#x9519;&#x8BEF;&#xFF0C;&#x5219; Node.js &#x4F1A;&#x91CD;&#x8BD5;&#x8BE5;&#x64CD;&#x4F5C;&#xFF08;&#x6BCF;&#x6B21;&#x5C1D;&#x8BD5;&#x65F6;&#x4F7F;&#x7528; <code>retryDelay</code> &#x6BEB;&#x79D2;&#x65F6;&#x957F;&#x7684;&#x7EBF;&#x6027;&#x56DE;&#x9000;&#x7B49;&#x5F85;&#xFF09;&#x3002;
  &#x6B64;&#x9009;&#x9879;&#x8868;&#x793A;&#x91CD;&#x8BD5;&#x7684;&#x6B21;&#x6570;&#x3002;
  &#x5982;&#x679C; <code>recursive</code> &#x9009;&#x9879;&#x4E0D;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x6B64;&#x9009;&#x9879;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  <li><code>recursive</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x5982;&#x679C;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x6267;&#x884C;&#x9012;&#x5F52;&#x7684;&#x76EE;&#x5F55;&#x5220;&#x9664;&#x3002;
  &#x5728;&#x9012;&#x5F52;&#x6A21;&#x5F0F;&#x4E2D;&#xFF0C;&#x9519;&#x8BEF;&#x4E0D;&#x4F1A;&#x88AB;&#x62A5;&#x544A;&#xFF08;&#x5982;&#x679C; <code>path</code> &#x4E0D;&#x5B58;&#x5728;&#xFF09;&#xFF0C;&#x5E76;&#x4E14;&#x64CD;&#x4F5C;&#x4F1A;&#x88AB;&#x91CD;&#x8BD5;&#xFF08;&#x5F53;&#x5931;&#x8D25;&#x65F6;&#xFF09;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>retryDelay</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x91CD;&#x8BD5;&#x4E4B;&#x95F4;&#x7B49;&#x5F85;&#x7684;&#x65F6;&#x95F4;&#xFF08;&#x4EE5;&#x6BEB;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#xFF09;&#x3002;
  &#x5982;&#x679C; <code>recursive</code> &#x9009;&#x9879;&#x4E0D;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x6B64;&#x9009;&#x9879;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>100</code>&#x3002;</li>
  </ul>
  </li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/BuUYuq" rel="nofollow"><code>rmdir(2)</code></a>&#x3002;
  &#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <p>&#x5BF9;&#x6587;&#x4EF6;&#xFF08;&#x800C;&#x4E0D;&#x662F;&#x76EE;&#x5F55;&#xFF09;&#x4F7F;&#x7528; <code>fs.rmdirSync()</code> &#x4F1A;&#x5BFC;&#x81F4; <code>ENOENT</code> &#x9519;&#x8BEF;&#xFF08;&#x5728; Windows &#x4E0A;&#xFF09;&#x6216; <code>ENOTDIR</code> &#x9519;&#x8BEF;&#xFF08;&#x5728; POSIX &#x4E0A;&#xFF09;&#x3002;</p>
  <h2><code>fs.stat(path[, options], callback)</code><span><a class="mark" href="#fs_fs_stat_path_options_callback" id="fs_fs_stat_path_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_stat_path_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_stat_path_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>&#x63A5;&#x53D7;&#x989D;&#x5916;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; bigint&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.0.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.0.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x8FD4;&#x56DE;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; <code>bigint</code> &#x578B;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>stats</code> <a href="/s/NMuvVx" target="_blank" rel="nofollow" class="type">&lt;fs.Stats&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/7U6CBC" rel="nofollow"><code>stat(2)</code></a>&#x3002;
  &#x56DE;&#x8C03;&#x6709;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(err, stats)</code>&#xFF0C;&#x5176;&#x4E2D; <code>stats</code> &#x662F; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#xFF0C;&#x5219; <code>err.code</code> &#x4F1A;&#x662F;<a href="/s/5wcdGc" rel="nofollow">&#x5E38;&#x89C1;&#x7684;&#x7CFB;&#x7EDF;&#x9519;&#x8BEF;</a>&#x4E4B;&#x4E00;&#x3002;</p>
  <p>&#x4E0D;&#x5EFA;&#x8BAE;&#x5728;&#x8C03;&#x7528; <code>fs.open()</code>&#x3001; <code>fs.readFile()</code> &#x6216; <code>fs.writeFile()</code> &#x4E4B;&#x524D;&#x4F7F;&#x7528; <code>fs.stat()</code> &#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x7684;&#x5B58;&#x5728;&#x6027;&#x3002;
  &#x800C;&#x662F;&#x5E94;&#x8BE5;&#x76F4;&#x63A5;&#x5730;&#x6253;&#x5F00;&#x3001;&#x8BFB;&#x53D6;&#x6216;&#x5199;&#x5165;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x53EF;&#x7528;&#xFF0C;&#x5219;&#x5904;&#x7406;&#x5F15;&#x53D1;&#x7684;&#x9519;&#x8BEF;&#x3002;</p>
  <p>&#x82E5;&#x8981;&#x53EA;&#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x5B58;&#x5728;&#xFF0C;&#x4F46;&#x6CA1;&#x6709;&#x66F4;&#x591A;&#x7684;&#x64CD;&#x4F5C;&#xFF0C;&#x5219;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528; <a href="/s/NCPsM3" rel="nofollow"><code>fs.access()</code></a>&#x3002;</p>
  <p>&#x4F8B;&#x5982;&#xFF0C;&#x7ED9;&#x5B9A;&#x4EE5;&#x4E0B;&#x7684;&#x76EE;&#x5F55;&#x7ED3;&#x6784;&#xFF1A;</p>
  <pre><code class="language-text">- &#x76EE;&#x5F55;
  -- &#x6587;&#x4EF6;.txt
  - &#x6587;&#x4EF6;.js</code></pre>
  <p>&#x4EE5;&#x4E0B;&#x7A0B;&#x5E8F;&#x4F1A;&#x68C0;&#x67E5;&#x7ED9;&#x5B9A;&#x8DEF;&#x5F84;&#x7684;&#x6587;&#x4EF6;&#x5C5E;&#x6027;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  
  <span class="hljs-keyword">const</span> pathsToCheck = [<span class="hljs-string">&apos;./&#x76EE;&#x5F55;&apos;</span>, <span class="hljs-string">&apos;./&#x76EE;&#x5F55;/&#x6587;&#x4EF6;.txt&apos;</span>];
  
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; pathsToCheck.length; i++) {
    fs.stat(pathsToCheck[i], <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">err, stats</span>) </span>{
      <span class="hljs-built_in">console</span>.log(stats.isDirectory());
      <span class="hljs-built_in">console</span>.log(stats);
    });
  }</code></pre>
  <p>&#x7ED3;&#x679C;&#x7684;&#x8F93;&#x51FA;&#x4F1A;&#x7C7B;&#x4F3C;&#x4E8E;&#xFF1A;</p>
  <pre><code class="language-console">true
  Stats {
    dev: 16777220,
    mode: 16877,
    nlink: 3,
    uid: 501,
    gid: 20,
    rdev: 0,
    blksize: 4096,
    ino: 14214262,
    size: 96,
    blocks: 0,
    atimeMs: 1561174653071.963,
    mtimeMs: 1561174614583.3518,
    ctimeMs: 1561174626623.5366,
    birthtimeMs: 1561174126937.2893,
    atime: 2019-06-22T03:37:33.072Z,
    mtime: 2019-06-22T03:36:54.583Z,
    ctime: 2019-06-22T03:37:06.624Z,
    birthtime: 2019-06-22T03:28:46.937Z
  }
  false
  Stats {
    dev: 16777220,
    mode: 33188,
    nlink: 1,
    uid: 501,
    gid: 20,
    rdev: 0,
    blksize: 4096,
    ino: 14214074,
    size: 8,
    blocks: 8,
    atimeMs: 1561174616618.8555,
    mtimeMs: 1561174614584,
    ctimeMs: 1561174614583.8145,
    birthtimeMs: 1561174007710.7478,
    atime: 2019-06-22T03:36:56.619Z,
    mtime: 2019-06-22T03:36:54.584Z,
    ctime: 2019-06-22T03:36:54.584Z,
    birthtime: 2019-06-22T03:26:47.711Z
  }</code></pre>
  <h2><code>fs.statSync(path[, options])</code><span><a class="mark" href="#fs_fs_statsync_path_options" id="fs_fs_statsync_path_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_statsync_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_statsync_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>&#x63A5;&#x53D7;&#x989D;&#x5916;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; bigint&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x8FD4;&#x56DE;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x5E94;&#x4E3A; <code>bigint</code> &#x578B;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/NMuvVx" target="_blank" rel="nofollow" class="type">&lt;fs.Stats&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/7U6CBC" rel="nofollow"><code>stat(2)</code></a>&#x3002;</p>
  <h2><code>fs.symlink(target, path[, type], callback)</code><span><a class="mark" href="#fs_fs_symlink_target_path_type_callback" id="fs_fs_symlink_target_path_type_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_symlink_target_path_type_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_symlink_target_path_type_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v12.0.0</td>
  <td><p>If the <code>type</code> argument is left undefined, Node will autodetect <code>target</code> type and automatically select <code>dir</code> or <code>file</code></p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>The <code>target</code> and <code>path</code> parameters can be WHATWG <code>URL</code> objects using <code>file:</code> protocol. Support is currently still <em>experimental</em>.</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>target</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>type</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/th7NwY" rel="nofollow"><code>symlink(2)</code></a>&#xFF0C;&#x5B83;&#x4F1A;&#x521B;&#x5EFA;&#x540D;&#x4E3A; <code>path</code> &#x7684;&#x94FE;&#x63A5;&#xFF0C;&#x8BE5;&#x94FE;&#x63A5;&#x6307;&#x5411; <code>target</code>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <p><code>type</code> &#x53C2;&#x6570;&#x4EC5;&#x5728; Windows &#x4E0A;&#x53EF;&#x7528;&#xFF0C;&#x5728;&#x5176;&#x4ED6;&#x5E73;&#x53F0;&#x4E0A;&#x5219;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;
  &#x5B83;&#x53EF;&#x4EE5;&#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;dir&apos;</code>&#x3001; <code>&apos;file&apos;</code> &#x6216; <code>&apos;junction&apos;</code>&#x3002;
  &#x5982;&#x679C;&#x672A;&#x8BBE;&#x7F6E; <code>type</code> &#x53C2;&#x6570;&#xFF0C;&#x5219; Node.js &#x5C06;&#x4F1A;&#x81EA;&#x52A8;&#x68C0;&#x6D4B; <code>target</code> &#x7684;&#x7C7B;&#x578B;&#x5E76;&#x4F7F;&#x7528; <code>&apos;file&apos;</code> &#x6216; <code>&apos;dir&apos;</code>&#x3002;
  &#x5982;&#x679C; <code>target</code> &#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x5C06;&#x4F1A;&#x4F7F;&#x7528; <code>&apos;file&apos;</code>&#x3002;
  Windows &#x4E0A;&#x7684;&#x8FDE;&#x63A5;&#x70B9;&#x8981;&#x6C42;&#x76EE;&#x6807;&#x8DEF;&#x5F84;&#x662F;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x3002;
  &#x5F53;&#x4F7F;&#x7528; <code>&apos;junction&apos;</code> &#x65F6;&#xFF0C; <code>target</code> &#x53C2;&#x6570;&#x5C06;&#x4F1A;&#x81EA;&#x52A8;&#x5730;&#x6807;&#x51C6;&#x5316;&#x4E3A;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x3002;</p>
  <p>&#x76F8;&#x5BF9;&#x76EE;&#x6807;&#x662F;&#x76F8;&#x5BF9;&#x4E8E;&#x94FE;&#x63A5;&#x7684;&#x7236;&#x76EE;&#x5F55;&#x3002;</p>
  <pre><code class="language-js">fs.symlink(<span class="hljs-string">&apos;./mew&apos;</span>, <span class="hljs-string">&apos;./example/mewtwo&apos;</span>, callback);</code></pre>
  <p>&#x4E0A;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x4E2D;&#xFF0C;&#x5728; <code>example</code> &#x4E2D;&#x521B;&#x5EFA;&#x4E86;&#x7B26;&#x53F7;&#x94FE;&#x63A5; <code>mewtwo</code>&#xFF0C;&#x5B83;&#x6307;&#x5411;&#x540C;&#x4E00;&#x76EE;&#x5F55;&#x4E2D;&#x7684; <code>mew</code>&#xFF1A;</p>
  <pre><code class="language-bash">$ tree example/
  example/
  &#x251C;&#x2500;&#x2500; mew
  &#x2514;&#x2500;&#x2500; mewtwo -&gt; ./mew</code></pre>
  <h2><code>fs.symlinkSync(target, path[, type])</code><span><a class="mark" href="#fs_fs_symlinksync_target_path_type" id="fs_fs_symlinksync_target_path_type">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_symlinksync_target_path_type.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_symlinksync_target_path_type.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v12.0.0</td>
  <td><p>If the <code>type</code> argument is left undefined, Node will autodetect <code>target</code> type and automatically select <code>dir</code> or <code>file</code></p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>The <code>target</code> and <code>path</code> parameters can be WHATWG <code>URL</code> objects using <code>file:</code> protocol. Support is currently still <em>experimental</em>.</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>target</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>type</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  </ul>
  <p>&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/nwAtfE" rel="nofollow"><code>fs.symlink()</code></a>&#x3002;</p>
  <h2><code>fs.truncate(path[, len], callback)</code><span><a class="mark" href="#fs_fs_truncate_path_len_callback" id="fs_fs_truncate_path_len_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_truncate_path_len_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_truncate_path_len_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.8.6</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.8.6</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>len</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/9o417s" rel="nofollow"><code>truncate(2)</code></a>&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;
  &#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x4E5F;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x4F20;&#x5165;&#x3002; 
  &#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x8C03;&#x7528; <code>fs.ftruncate()</code>&#x3002;</p>
  <p>&#x4E0D;&#x63A8;&#x8350;&#x4F20;&#x5165;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#xFF0C;&#x53EF;&#x80FD;&#x5BFC;&#x81F4;&#x5C06;&#x6765;&#x629B;&#x51FA;&#x9519;&#x8BEF;&#x3002;</p>
  <h2><code>fs.truncateSync(path[, len])</code><span><a class="mark" href="#fs_fs_truncatesync_path_len" id="fs_fs_truncatesync_path_len">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_truncatesync_path_len.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_truncatesync_path_len.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.8.6</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>len</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/9o417s" rel="nofollow"><code>truncate(2)</code></a>&#x3002;
  &#x8FD4;&#x56DE; <code>undefined</code>&#x3002;
  &#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x4E5F;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x4F20;&#x5165;&#x3002;
  &#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x8C03;&#x7528; <code>fs.ftruncateSync()</code>&#x3002;</p>
  <p>&#x4E0D;&#x63A8;&#x8350;&#x4F20;&#x5165;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#xFF0C;&#x53EF;&#x80FD;&#x5BFC;&#x81F4;&#x5C06;&#x6765;&#x629B;&#x51FA;&#x9519;&#x8BEF;&#x3002;</p>
  <h2><code>fs.unlink(path, callback)</code><span><a class="mark" href="#fs_fs_unlink_path_callback" id="fs_fs_unlink_path_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_unlink_path_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_unlink_path_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.0.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.0.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x5220;&#x9664;&#x6587;&#x4EF6;&#x6216;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#x3002;
  &#x9664;&#x4E86;&#x53EF;&#x80FD;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5B8C;&#x6210;&#x56DE;&#x8C03;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x53C2;&#x6570;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x5047;&#x8BBE; &apos;&#x6587;&#x4EF6;.txt&apos; &#x662F;&#x666E;&#x901A;&#x7684;&#x6587;&#x4EF6;&#x3002;</span>
  fs.unlink(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&#x5DF2;&#x88AB;&#x5220;&#x9664;&apos;</span>);
  });</code></pre>
  <p><code>fs.unlink()</code> &#x5BF9;&#x7A7A;&#x6216;&#x975E;&#x7A7A;&#x7684;&#x76EE;&#x5F55;&#x5747;&#x4E0D;&#x8D77;&#x4F5C;&#x7528;&#x3002;
  &#x82E5;&#x8981;&#x5220;&#x9664;&#x76EE;&#x5F55;&#xFF0C;&#x5219;&#x4F7F;&#x7528; <a href="/s/ptRuXZ" rel="nofollow"><code>fs.rmdir()</code></a>&#x3002;</p>
  <p>&#x4E5F;&#x53EF;&#x53C2;&#x89C1; <a href="/s/gjRRsM" rel="nofollow"><code>unlink(2)</code></a>&#x3002;</p>
  <h2><code>fs.unlinkSync(path)</code><span><a class="mark" href="#fs_fs_unlinksync_path" id="fs_fs_unlinksync_path">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_unlinksync_path.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_unlinksync_path.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  </ul>
  <p>&#x540C;&#x6B65;&#x7684; <a href="/s/gjRRsM" rel="nofollow"><code>unlink(2)</code></a>&#x3002;
  &#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <h2><code>fs.unwatchFile(filename[, listener])</code><span><a class="mark" href="#fs_fs_unwatchfile_filename_listener" id="fs_fs_unwatchfile_filename_listener">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_unwatchfile_filename_listener.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_unwatchfile_filename_listener.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span>
  </div>
  <ul>
  <li><code>filename</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>listener</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a> &#x53EF;&#x9009;&#x7684;&#xFF0C;&#x4E4B;&#x524D;&#x4F7F;&#x7528; <code>fs.watchFile()</code> &#x7ED1;&#x5B9A;&#x7684;&#x76D1;&#x542C;&#x5668;&#x3002;</li>
  </ul>
  <p>&#x505C;&#x6B62;&#x76D1;&#x89C6; <code>filename</code> &#x7684;&#x53D8;&#x5316;&#x3002;
  &#x5982;&#x679C;&#x6307;&#x5B9A;&#x4E86; <code>listener</code>&#xFF0C;&#x5219;&#x4EC5;&#x79FB;&#x9664;&#x6B64;&#x7279;&#x5B9A;&#x76D1;&#x542C;&#x5668;&#xFF0C;&#x5426;&#x5219;&#xFF0C;&#x5C06;&#x79FB;&#x9664;&#x6240;&#x6709;&#x76D1;&#x542C;&#x5668;&#xFF0C;&#x4ECE;&#x800C;&#x505C;&#x6B62;&#x76D1;&#x89C6; <code>filename</code>&#x3002;</p>
  <p>&#x5BF9;&#x672A;&#x88AB;&#x76D1;&#x89C6;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x8C03;&#x7528; <code>fs.unwatchFile()</code> &#x5C06;&#x662F;&#x7A7A;&#x64CD;&#x4F5C;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x9519;&#x8BEF;&#x3002;</p>
  <p>&#x4F7F;&#x7528; <a href="/s/h2QY7Q" rel="nofollow"><code>fs.watch()</code></a> &#x6BD4; <code>fs.watchFile()</code> &#x548C; <code>fs.unwatchFile()</code> &#x66F4;&#x9AD8;&#x6548;&#x3002;
  &#x5E94;&#x5C3D;&#x53EF;&#x80FD;&#x4F7F;&#x7528; <code>fs.watch()</code> &#x4EE3;&#x66FF; <code>fs.watchFile()</code> &#x548C; <code>fs.unwatchFile()</code>&#x3002;</p>
  <h2><code>fs.utimes(path, atime, mtime, callback)</code><span><a class="mark" href="#fs_fs_utimes_path_atime_mtime_callback" id="fs_fs_utimes_path_atime_mtime_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_utimes_path_atime_mtime_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_utimes_path_atime_mtime_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v8.0.0</td>
  <td><p><code>NaN</code>, <code>Infinity</code>, and <code>-Infinity</code> are no longer valid time specifiers.</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v4.1.0</td>
  <td><p>Numeric strings, <code>NaN</code> and <code>Infinity</code> are now allowed time specifiers.</p></td></tr>
  <tr><td>v0.4.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.4.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>atime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li><code>mtime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x66F4;&#x6539; <code>path</code> &#x6307;&#x5411;&#x7684;&#x5BF9;&#x8C61;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x65F6;&#x95F4;&#x6233;&#x3002;</p>
  <p><code>atime</code> &#x548C; <code>mtime</code> &#x53C2;&#x6570;&#x9075;&#x5FAA;&#x4EE5;&#x4E0B;&#x89C4;&#x5219;&#xFF1A;</p>
  <ul>
  <li>&#x503C;&#x53EF;&#x4EE5;&#x662F;&#x8868;&#x793A; Unix &#x7EAA;&#x5143;&#x65F6;&#x95F4;&#xFF08;&#x4EE5;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#xFF09;&#x7684;&#x6570;&#x5B57;&#x3001; <code>Date</code> &#x5BF9;&#x8C61;&#x3001;&#x6216;&#x7C7B;&#x4F3C; <code>&apos;123456789.0&apos;</code> &#x7684;&#x6570;&#x503C;&#x5B57;&#x7B26;&#x4E32;&#x3002;</li>
  <li>&#x5982;&#x679C;&#x8BE5;&#x503C;&#x65E0;&#x6CD5;&#x8F6C;&#x6362;&#x4E3A;&#x6570;&#x503C;&#x3001;&#x6216;&#x503C;&#x4E3A; <code>NaN</code>&#x3001; <code>Infinity</code> &#x6216; <code>-Infinity</code>&#xFF0C;&#x5219;&#x629B;&#x51FA;&#x9519;&#x8BEF;&#x3002;</li>
  </ul>
  <h2><code>fs.utimesSync(path, atime, mtime)</code><span><a class="mark" href="#fs_fs_utimessync_path_atime_mtime" id="fs_fs_utimessync_path_atime_mtime">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_utimessync_path_atime_mtime.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_utimessync_path_atime_mtime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v8.0.0</td>
  <td><p><code>NaN</code>, <code>Infinity</code>, and <code>-Infinity</code> are no longer valid time specifiers.</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>path</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x662F;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v4.1.0</td>
  <td><p>Numeric strings, <code>NaN</code> and <code>Infinity</code> are now allowed time specifiers.</p></td></tr>
  <tr><td>v0.4.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.4.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>atime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li><code>mtime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  </ul>
  <p>&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/UxAPRV" rel="nofollow"><code>fs.utimes()</code></a>&#x3002;</p>
  <h2><code>fs.watch(filename[, options][, listener])</code><span><a class="mark" href="#fs_fs_watch_filename_options_listener" id="fs_fs_watch_filename_options_listener">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_watch_filename_options_listener.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_watch_filename_options_listener.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>filename</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x5728;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x4F20;&#x5165;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#x65E0;&#x6CD5;&#x518D;&#x88AB;&#x4FEE;&#x6539;&#x3002;</p></td></tr>
  <tr><td>v0.5.10</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.5.10</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>filename</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>persistent</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x6307;&#x793A;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5DF2;&#x6B63;&#x88AB;&#x76D1;&#x89C6;&#xFF0C;&#x8FDB;&#x7A0B;&#x662F;&#x5426;&#x5E94;&#x7EE7;&#x7EED;&#x8FD0;&#x884C;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>true</code>&#x3002;</li>
  <li><code>recursive</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x6307;&#x793A;&#x5E94;&#x8BE5;&#x76D1;&#x89C6;&#x6240;&#x6709;&#x5B50;&#x76EE;&#x5F55;&#xFF0C;&#x8FD8;&#x662F;&#x4EC5;&#x76D1;&#x89C6;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x3002;&#x8FD9;&#x9002;&#x7528;&#x4E8E;&#x76D1;&#x89C6;&#x76EE;&#x5F55;&#x65F6;&#xFF0C;&#x5E76;&#x4E14;&#x4EC5;&#x9002;&#x7528;&#x4E8E;&#x53D7;&#x652F;&#x6301;&#x7684;&#x5E73;&#x53F0;&#xFF08;&#x53C2;&#x89C1;<a href="/s/PJEx13" rel="nofollow">&#x6CE8;&#x610F;&#x4E8B;&#x9879;</a>&#xFF09;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x4F20;&#x7ED9;&#x76D1;&#x542C;&#x5668;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>listener</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a> | <a href="/s/8ym6ow" target="_blank" rel="nofollow" class="type">&lt;undefined&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>undefined</code>&#x3002;</p>
  <ul>
  <li><code>eventType</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  <li><code>filename</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/8XNtAD" target="_blank" rel="nofollow" class="type">&lt;fs.FSWatcher&gt;</a></li>
  </ul>
  <p>&#x76D1;&#x89C6; <code>filename</code> &#x7684;&#x66F4;&#x6539;&#xFF0C;&#x5176;&#x4E2D; <code>filename</code> &#x662F;&#x6587;&#x4EF6;&#x6216;&#x76EE;&#x5F55;&#x3002;</p>
  <p>&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002;
  &#x5982;&#x679C; <code>options</code> &#x4F20;&#x5165;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A; <code>encoding</code>&#x3002;
  &#x5426;&#x5219;&#xFF0C; <code>options</code> &#x5E94;&#x4F20;&#x5165;&#x5BF9;&#x8C61;&#x3002;</p>
  <p>&#x76D1;&#x542C;&#x5668;&#x56DE;&#x8C03;&#x6709;&#x4E24;&#x4E2A;&#x53C2;&#x6570; <code>(eventType, filename)</code>&#x3002;
  <code>eventType</code> &#x662F; <code>&apos;rename&apos;</code> &#x6216; <code>&apos;change&apos;</code>&#xFF0C; <code>filename</code> &#x662F;&#x89E6;&#x53D1;&#x4E8B;&#x4EF6;&#x7684;&#x6587;&#x4EF6;&#x7684;&#x540D;&#x79F0;&#x3002;</p>
  <p>&#x5728;&#x5927;&#x591A;&#x6570;&#x5E73;&#x53F0;&#x4E0A;&#xFF0C;&#x6BCF;&#x5F53;&#x6587;&#x4EF6;&#x540D;&#x5728;&#x76EE;&#x5F55;&#x4E2D;&#x51FA;&#x73B0;&#x6216;&#x6D88;&#x5931;&#x65F6;&#xFF0C;&#x5C31;&#x4F1A;&#x89E6;&#x53D1; <code>&apos;rename&apos;</code> &#x4E8B;&#x4EF6;&#x3002;</p>
  <p>&#x76D1;&#x542C;&#x5668;&#x56DE;&#x8C03;&#x7ED1;&#x5B9A;&#x5728;&#x7531; <a href="/s/8XNtAD" rel="nofollow"><code>fs.FSWatcher</code></a> &#x89E6;&#x53D1;&#x7684; <code>&apos;change&apos;</code> &#x4E8B;&#x4EF6;&#x4E0A;&#xFF0C;&#x4F46;&#x5B83;&#x4E0E; <code>eventType</code> &#x7684; <code>&apos;change&apos;</code> &#x503C;&#x4E0D;&#x662F;&#x4E00;&#x56DE;&#x4E8B;&#x3002;</p>
  <h3>&#x6CE8;&#x610F;&#x4E8B;&#x9879;<span><a class="mark" href="#fs_caveats" id="fs_caveats">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/caveats.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/caveats.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <!--type=misc-->
  <p><code>fs.watch</code> &#x7684; API &#x5728;&#x5404;&#x4E2A;&#x5E73;&#x53F0;&#x4E0A;&#x5E76;&#x975E; 100&#xFF05; &#x4E00;&#x81F4;&#xFF0C;&#x5728;&#x67D0;&#x4E9B;&#x60C5;&#x51B5;&#x4E0B;&#x4E0D;&#x53EF;&#x7528;&#x3002;</p>
  <p>&#x4EC5;&#x5728; macOS &#x548C; Windows &#x4E0A;&#x652F;&#x6301; <code>recursive</code> &#x9009;&#x9879;&#x3002;
  &#x5F53;&#x5728;&#x4E0D;&#x652F;&#x6301;&#x8BE5;&#x9009;&#x9879;&#x7684;&#x5E73;&#x53F0;&#x4E0A;&#x4F7F;&#x7528;&#x8BE5;&#x9009;&#x9879;&#x65F6;&#xFF0C;&#x5219;&#x4F1A;&#x629B;&#x51FA; <code>ERR_FEATURE_UNAVAILABLE_ON_PLATFORM</code> &#x5F02;&#x5E38;&#x3002;</p>
  <p>&#x5728; Windows &#x4E0A;&#xFF0C;&#x5982;&#x679C;&#x76D1;&#x89C6;&#x7684;&#x76EE;&#x5F55;&#x88AB;&#x79FB;&#x52A8;&#x6216;&#x91CD;&#x547D;&#x540D;&#xFF0C;&#x5219;&#x4E0D;&#x4F1A;&#x89E6;&#x53D1;&#x4EFB;&#x4F55;&#x4E8B;&#x4EF6;&#x3002;
  &#x5F53;&#x76D1;&#x89C6;&#x7684;&#x76EE;&#x5F55;&#x88AB;&#x5220;&#x9664;&#x65F6;&#xFF0C;&#x5219;&#x62A5;&#x544A; <code>EPERM</code> &#x9519;&#x8BEF;&#x3002;</p>
  <h4>&#x53EF;&#x7528;&#x6027;<span><a class="mark" href="#fs_availability" id="fs_availability">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/availability.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/availability.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <!--type=misc-->
  <p>&#x6B64;&#x7279;&#x6027;&#x53D6;&#x51B3;&#x4E8E;&#x5E95;&#x5C42;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#xFF0C;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x79CD;&#x901A;&#x77E5;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x66F4;&#x6539;&#x7684;&#x65B9;&#x6CD5;&#x3002;</p>
  <ul>
  <li>&#x5728; Linux &#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x4F7F;&#x7528; <a href="/s/2vfjsf" rel="nofollow"><code>inotify(7)</code></a>&#x3002;</li>
  <li>&#x5728; BSD &#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x4F7F;&#x7528; <a href="/s/sKFUBp" rel="nofollow"><code>kqueue(2)</code></a>&#x3002;</li>
  <li>&#x5728; macOS &#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x5BF9;&#x6587;&#x4EF6;&#x4F7F;&#x7528; <a href="/s/sKFUBp" rel="nofollow"><code>kqueue(2)</code></a>&#xFF0C;&#x5BF9;&#x76EE;&#x5F55;&#x4F7F;&#x7528; <a href="/s/Asxgry" rel="nofollow"><code>FSEvents</code></a>&#x3002;</li>
  <li>&#x5728; SunOS &#x7CFB;&#x7EDF;&#x4E0A;&#xFF08;&#x5305;&#x62EC; Solaris &#x548C; SmartOS&#xFF09;&#xFF0C;&#x4F7F;&#x7528;<a href="/s/bqLYZP" rel="nofollow">&#x4E8B;&#x4EF6;&#x7AEF;&#x53E3;</a>&#x3002;</li>
  <li>&#x5728; Windows &#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x6B64;&#x7279;&#x6027;&#x53D6;&#x51B3;&#x4E8E; <a href="/s/Tbrfbe" rel="nofollow"><code>ReadDirectoryChangesW</code></a>&#x3002;</li>
  <li>&#x5728; Aix &#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x6B64;&#x7279;&#x6027;&#x53D6;&#x51B3;&#x4E8E; <a href="/s/uAha9z" rel="nofollow"><code>AHAFS</code></a> &#x5FC5;&#x987B;&#x542F;&#x52A8;&#x3002;</li>
  <li>&#x5728; IBM i &#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x4E0D;&#x652F;&#x6301;&#x6B64;&#x7279;&#x6027;&#x3002;</li>
  </ul>
  <p>&#x5982;&#x679C;&#x5E95;&#x5C42;&#x529F;&#x80FD;&#x7531;&#x4E8E;&#x67D0;&#x4E9B;&#x539F;&#x56E0;&#x4E0D;&#x53EF;&#x7528;&#xFF0C;&#x5219; <code>fs.watch()</code> &#x4F1A;&#x65E0;&#x6CD5;&#x8FD0;&#x884C;&#x4E14;&#x53EF;&#x80FD;&#x629B;&#x51FA;&#x5F02;&#x5E38;&#x3002;
  &#x4F8B;&#x5982;&#xFF0C;&#x5F53;&#x4F7F;&#x7528;&#x865A;&#x62DF;&#x5316;&#x8F6F;&#x4EF6;&#xFF08;&#x5982; Vagrant &#x6216; Docker&#xFF09;&#x65F6;&#xFF0C;&#x5728;&#x7F51;&#x7EDC;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#xFF08;NFS&#x3001;SMB &#x7B49;&#xFF09;&#x6216;&#x4E3B;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x4E0A;&#x76D1;&#x89C6;&#x6587;&#x4EF6;&#x6216;&#x76EE;&#x5F55;&#x53EF;&#x80FD;&#x662F;&#x4E0D;&#x53EF;&#x9760;&#x7684;&#xFF0C;&#x5728;&#x67D0;&#x4E9B;&#x60C5;&#x51B5;&#x4E0B;&#x4E5F;&#x662F;&#x4E0D;&#x53EF;&#x80FD;&#x7684;&#x3002;</p>
  <p>&#x4ECD;&#x7136;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>fs.watchFile()</code>&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x4F7F;&#x7528; stat &#x8F6E;&#x8BE2; &#xFF0C;&#x4F46;&#x8FD9;&#x79CD;&#x65B9;&#x6CD5;&#x8F83;&#x6162;&#x4E14;&#x4E0D;&#x592A;&#x53EF;&#x9760;&#x3002;</p>
  <h4>&#x7D22;&#x5F15;&#x8282;&#x70B9;<span><a class="mark" href="#fs_inodes" id="fs_inodes">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/inodes.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/inodes.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <!--type=misc-->
  <p>&#x5728; Linux &#x6216; macOS &#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C; <code>fs.watch()</code> &#x89E3;&#x6790;&#x8DEF;&#x5F84;&#x5230;<a href="/s/ofGTst" rel="nofollow">&#x7D22;&#x5F15;&#x8282;&#x70B9;</a>&#x5E76;&#x76D1;&#x89C6;&#x8BE5;&#x7D22;&#x5F15;&#x8282;&#x70B9;&#x3002;
  &#x5982;&#x679C;&#x5220;&#x9664;&#x5E76;&#x91CD;&#x65B0;&#x521B;&#x5EFA;&#x76D1;&#x89C6;&#x7684;&#x8DEF;&#x5F84;&#xFF0C;&#x5219;&#x4F1A;&#x4E3A;&#x5176;&#x5206;&#x914D;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x7D22;&#x5F15;&#x8282;&#x70B9;&#x3002;
  &#x76D1;&#x89C6;&#x5668;&#x4F1A;&#x56E0;&#x5220;&#x9664;&#x800C;&#x89E6;&#x53D1;&#x4E8B;&#x4EF6;&#xFF0C;&#x4F46;&#x4F1A;&#x7EE7;&#x7EED;&#x76D1;&#x89C6;&#x539F;&#x59CB;&#x7684;&#x7D22;&#x5F15;&#x8282;&#x70B9;&#x3002;
  &#x4E0D;&#x4F1A;&#x56E0;&#x65B0;&#x5EFA;&#x7D22;&#x5F15;&#x8282;&#x70B9;&#x800C;&#x89E6;&#x53D1;&#x4E8B;&#x4EF6;&#x3002;
  &#x8FD9;&#x662F;&#x9884;&#x671F;&#x7684;&#x884C;&#x4E3A;&#x3002;</p>
  <p>AIX &#x6587;&#x4EF6;&#x5728;&#x6587;&#x4EF6;&#x7684;&#x751F;&#x547D;&#x5468;&#x671F;&#x4E2D;&#x4FDD;&#x7559;&#x76F8;&#x540C;&#x7684;&#x7D22;&#x5F15;&#x8282;&#x70B9;&#x3002;
  &#x5728; AIX &#x4E0A;&#x4FDD;&#x5B58;&#x548C;&#x5173;&#x95ED;&#x76D1;&#x89C6;&#x7684;&#x6587;&#x4EF6;&#x5C06;&#x5BFC;&#x81F4;&#x4E24;&#x4E2A;&#x901A;&#x77E5;&#xFF08;&#x4E00;&#x4E2A;&#x7528;&#x4E8E;&#x6DFB;&#x52A0;&#x65B0;&#x5185;&#x5BB9;&#xFF0C;&#x4E00;&#x4E2A;&#x7528;&#x4E8E;&#x622A;&#x65AD;&#xFF09;&#x3002;</p>
  <h4>&#x6587;&#x4EF6;&#x540D;&#x53C2;&#x6570;<span><a class="mark" href="#fs_filename_argument" id="fs_filename_argument">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filename_argument.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filename_argument.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <!--type=misc-->
  <p>&#x4EC5;&#x5728; Linux&#x3001;macOS&#x3001;Windows &#x548C; AIX &#x4E0A;&#x652F;&#x6301;&#x5728;&#x56DE;&#x8C03;&#x4E2D;&#x63D0;&#x4F9B; <code>filename</code> &#x53C2;&#x6570;&#x3002;
  &#x5373;&#x4F7F;&#x5728;&#x652F;&#x6301;&#x7684;&#x5E73;&#x53F0;&#x4E0A;&#xFF0C;&#x4E5F;&#x4E0D;&#x603B;&#x662F;&#x4FDD;&#x8BC1;&#x63D0;&#x4F9B; <code>filename</code>&#x3002;
  &#x56E0;&#x6B64;&#xFF0C;&#x4E0D;&#x8981;&#x5047;&#x8BBE;&#x5728;&#x56DE;&#x8C03;&#x4E2D;&#x59CB;&#x7EC8;&#x63D0;&#x4F9B; <code>filename</code> &#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x4E14;&#x5982;&#x679C;&#x5B83;&#x4E3A; <code>null</code> &#x5219;&#x9700;&#x8981;&#x4E00;&#x4E9B;&#x540E;&#x5907;&#x903B;&#x8F91;&#x3002;</p>
  <pre><code class="language-js">fs.watch(<span class="hljs-string">&apos;somedir&apos;</span>, (eventType, filename) =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`&#x4E8B;&#x4EF6;&#x7C7B;&#x578B;&#x662F;: <span class="hljs-subst">${eventType}</span>`</span>);
    <span class="hljs-keyword">if</span> (filename) {
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`&#x63D0;&#x4F9B;&#x7684;&#x6587;&#x4EF6;&#x540D;: <span class="hljs-subst">${filename}</span>`</span>);
    } <span class="hljs-keyword">else</span> {
      <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&#x540D;&#x672A;&#x63D0;&#x4F9B;&apos;</span>);
    }
  });</code></pre>
  <h2><code>fs.watchFile(filename[, options], listener)</code><span><a class="mark" href="#fs_fs_watchfile_filename_options_listener" id="fs_fs_watchfile_filename_options_listener">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_watchfile_filename_options_listener.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_watchfile_filename_options_listener.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>The <code>bigint</code> option is now supported.</p></td></tr>
  <tr><td>v7.6.0</td>
  <td><p>&#x53C2;&#x6570; <code>filename</code> &#x53EF;&#x4EE5;&#x662F; WHATWG <code>URL</code> &#x5BF9;&#x8C61;&#xFF08;&#x4F7F;&#x7528; <code>file:</code> &#x534F;&#x8BAE;&#xFF09;&#x3002; &#x8BE5;&#x652F;&#x6301;&#x76EE;&#x524D;&#x4ECD;&#x5728;&#x5B9E;&#x9A8C;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.31</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.31</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>filename</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>persistent</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>true</code>&#x3002;</li>
  <li><code>interval</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>5007</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>listener</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>current</code> <a href="/s/NMuvVx" target="_blank" rel="nofollow" class="type">&lt;fs.Stats&gt;</a></li>
  <li><code>previous</code> <a href="/s/NMuvVx" target="_blank" rel="nofollow" class="type">&lt;fs.Stats&gt;</a></li>
  </ul>
  </li>
  <li>Returns: <a href="/s/EtjXhr" target="_blank" rel="nofollow" class="type">&lt;fs.StatWatcher&gt;</a></li>
  </ul>
  <p>&#x76D1;&#x89C6; <code>filename</code> &#x7684;&#x66F4;&#x6539;&#x3002;
  &#x6BCF;&#x5F53;&#x8BBF;&#x95EE;&#x6587;&#x4EF6;&#x65F6;&#x90FD;&#x4F1A;&#x8C03;&#x7528; <code>listener</code> &#x56DE;&#x8C03;&#x3002;</p>
  <p><code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x7701;&#x7565;&#x3002;
  &#x5982;&#x679C;&#x63D0;&#x4F9B;&#xFF0C;&#x5219;&#x5B83;&#x5E94;&#x8BE5;&#x662F;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x3002;
  <code>options</code> &#x5BF9;&#x8C61;&#x53EF;&#x4EE5;&#x5305;&#x542B;&#x4E00;&#x4E2A;&#x540D;&#x4E3A; <code>persistent</code> &#x7684;&#x5E03;&#x5C14;&#x503C;&#xFF0C;&#x6307;&#x793A;&#x5F53;&#x6587;&#x4EF6;&#x6B63;&#x5728;&#x88AB;&#x76D1;&#x89C6;&#x65F6;&#xFF0C;&#x8FDB;&#x7A0B;&#x662F;&#x5426;&#x5E94;&#x8BE5;&#x7EE7;&#x7EED;&#x8FD0;&#x884C;&#x3002;
  <code>options</code> &#x5BF9;&#x8C61;&#x53EF;&#x4EE5;&#x6307;&#x5B9A; <code>interval</code> &#x5C5E;&#x6027;&#xFF0C;&#x6307;&#x793A;&#x8F6E;&#x8BE2;&#x76EE;&#x6807;&#x7684;&#x9891;&#x7387;&#xFF08;&#x4EE5;&#x6BEB;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#xFF09;&#x3002;</p>
  <p><code>listener</code> &#x6709;&#x4E24;&#x4E2A;&#x53C2;&#x6570;&#xFF0C;&#x5F53;&#x524D;&#x7684; stat &#x5BF9;&#x8C61;&#x548C;&#x4E4B;&#x524D;&#x7684; stat &#x5BF9;&#x8C61;&#xFF1A;</p>
  <pre><code class="language-js">fs.watchFile(<span class="hljs-string">&apos;message.text&apos;</span>, (curr, prev) =&gt; {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`&#x5F53;&#x524D;&#x7684;&#x6700;&#x8FD1;&#x4FEE;&#x6539;&#x65F6;&#x95F4;&#x662F;: <span class="hljs-subst">${curr.mtime}</span>`</span>);
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`&#x4E4B;&#x524D;&#x7684;&#x6700;&#x8FD1;&#x4FEE;&#x6539;&#x65F6;&#x95F4;&#x662F;: <span class="hljs-subst">${prev.mtime}</span>`</span>);
  });</code></pre>
  <p>&#x8FD9;&#x4E9B; stat &#x5BF9;&#x8C61;&#x662F; <code>fs.Stat</code> &#x7684;&#x5B9E;&#x4F8B;&#x3002;
  &#x5982;&#x679C; <code>bigint</code> &#x9009;&#x9879;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x8FD9;&#x4E9B;&#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x4F1A;&#x88AB;&#x6307;&#x5B9A;&#x4E3A; <code>BigInts</code> &#x7C7B;&#x578B;&#x3002;</p>
  <p>&#x8981;&#x5728;&#x4FEE;&#x6539;&#x6587;&#x4EF6;&#xFF08;&#x800C;&#x4E0D;&#x4EC5;&#x4EC5;&#x662F;&#x8BBF;&#x95EE;&#xFF09;&#x65F6;&#x6536;&#x5230;&#x901A;&#x77E5;&#xFF0C;&#x5219;&#x9700;&#x8981;&#x6BD4;&#x8F83; <code>curr.mtime</code> &#x548C; <code>prev.mtime</code>&#x3002;</p>
  <p>&#x5F53; <code>fs.watchFile</code> &#x64CD;&#x4F5C;&#x5BFC;&#x81F4; <code>ENOENT</code> &#x9519;&#x8BEF;&#x65F6;&#xFF0C;&#x5B83;&#x5C06;&#x8C03;&#x7528;&#x4E00;&#x6B21;&#x76D1;&#x542C;&#x5668;&#xFF0C;&#x5E76;&#x5C06;&#x6240;&#x6709;&#x5B57;&#x6BB5;&#x7F6E;&#x96F6;&#xFF08;&#x6216;&#x5C06;&#x65E5;&#x671F;&#x8BBE;&#x4E3A; Unix &#x7EAA;&#x5143;&#xFF09;&#x3002;
  &#x5982;&#x679C;&#x6587;&#x4EF6;&#x662F;&#x5728;&#x90A3;&#x4E4B;&#x540E;&#x521B;&#x5EFA;&#x7684;&#xFF0C;&#x5219;&#x76D1;&#x542C;&#x5668;&#x4F1A;&#x88AB;&#x518D;&#x6B21;&#x8C03;&#x7528;&#xFF0C;&#x4E14;&#x5E26;&#x4E0A;&#x6700;&#x65B0;&#x7684; stat &#x5BF9;&#x8C61;&#x3002;
  &#x8FD9;&#x662F; v0.10 &#x4E4B;&#x540E;&#x7684;&#x529F;&#x80FD;&#x53D8;&#x5316;&#x3002;</p>
  <p>&#x4F7F;&#x7528; <a href="/s/h2QY7Q" rel="nofollow"><code>fs.watch()</code></a> &#x6BD4; <code>fs.watchFile</code> &#x548C; <code>fs.unwatchFile</code> &#x66F4;&#x9AD8;&#x6548;&#x3002;
  &#x5E94;&#x5C3D;&#x53EF;&#x80FD;&#x4F7F;&#x7528; <code>fs.watch</code> &#x4EE3;&#x66FF; <code>fs.watchFile</code> &#x548C; <code>fs.unwatchFile</code>&#x3002;</p>
  <p>&#x5F53; <code>fs.watchFile()</code> &#x6B63;&#x5728;&#x76D1;&#x89C6;&#x7684;&#x6587;&#x4EF6;&#x6D88;&#x5931;&#x5E76;&#x91CD;&#x65B0;&#x51FA;&#x73B0;&#x65F6;&#xFF0C;&#x7B2C;&#x4E8C;&#x6B21;&#x56DE;&#x8C03;&#x4E8B;&#x4EF6;&#xFF08;&#x6587;&#x4EF6;&#x91CD;&#x65B0;&#x51FA;&#x73B0;&#xFF09;&#x4E2D;&#x7684; <code>previous</code> &#x7684;&#x5185;&#x5BB9;&#x4F1A;&#x4E0E;&#x7B2C;&#x4E00;&#x6B21;&#x56DE;&#x8C03;&#x4E8B;&#x4EF6;&#xFF08;&#x6587;&#x4EF6;&#x6D88;&#x5931;&#xFF09;&#x4E2D;&#x7684; <code>previous</code> &#x7684;&#x5185;&#x5BB9;&#x76F8;&#x540C;&#x3002;</p>
  <p>&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x53D1;&#x751F;&#x5728;:</p>
  <ul>
  <li>&#x6587;&#x4EF6;&#x88AB;&#x5220;&#x9664;&#xFF0C;&#x7136;&#x540E;&#x53C8;&#x6062;&#x590D;&#x3002;</li>
  <li>&#x6587;&#x4EF6;&#x88AB;&#x91CD;&#x547D;&#x540D;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x7B2C;&#x4E8C;&#x6B21;&#x91CD;&#x547D;&#x540D;&#x56DE;&#x5176;&#x539F;&#x6765;&#x7684;&#x540D;&#x79F0;&#x3002;</li>
  </ul>
  <h2><code>fs.write(fd, buffer[, offset[, length[, position]]], callback)</code><span><a class="mark" href="#fs_fs_write_fd_buffer_offset_length_position_callback" id="fs_fs_write_fd_buffer_offset_length_position_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_write_fd_buffer_offset_length_position_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_write_fd_buffer_offset_length_position_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>buffer</code> &#x4E0D;&#x518D;&#x5F3A;&#x5236;&#x628A;&#x4E0D;&#x652F;&#x6301;&#x7684;&#x8F93;&#x5165;&#x8F6C;&#x6362;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p></td></tr>
  <tr><td>v10.10.0</td>
  <td><p>&#x53C2;&#x6570; <code>buffer</code> &#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x4F55; <code>TypedArray</code> &#x6216; <code>DataView</code>&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.4.0</td>
  <td><p>&#x53C2;&#x6570; <code>buffer</code> &#x53EF;&#x4EE5;&#x662F; <code>Uint8Array</code>&#x3002;</p></td></tr>
  <tr><td>v7.2.0</td>
  <td><p>&#x53C2;&#x6570; <code>offset</code> &#x548C; <code>length</code> &#x662F;&#x53EF;&#x9009;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.0.2</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.0.2</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/oh3CkV" target="_blank" rel="nofollow" class="type">&lt;TypedArray&gt;</a> | <a href="/s/yCdVkD" target="_blank" rel="nofollow" class="type">&lt;DataView&gt;</a></li>
  <li><code>offset</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>length</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>bytesWritten</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/oh3CkV" target="_blank" rel="nofollow" class="type">&lt;TypedArray&gt;</a> | <a href="/s/yCdVkD" target="_blank" rel="nofollow" class="type">&lt;DataView&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5199;&#x5165; <code>buffer</code> &#x5230; <code>fd</code> &#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x3002;</p>
  <p><code>offset</code> &#x51B3;&#x5B9A; buffer &#x4E2D;&#x8981;&#x88AB;&#x5199;&#x5165;&#x7684;&#x90E8;&#x4F4D;&#xFF0C; <code>length</code> &#x662F;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x8981;&#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</p>
  <p><code>position</code> &#x6307;&#x5B9A;&#x6587;&#x4EF6;&#x5F00;&#x5934;&#x7684;&#x504F;&#x79FB;&#x91CF;&#xFF08;&#x6570;&#x636E;&#x8981;&#x88AB;&#x5199;&#x5165;&#x7684;&#x4F4D;&#x7F6E;&#xFF09;&#x3002;
  &#x5982;&#x679C; <code>typeof position !== &apos;number&apos;</code>&#xFF0C;&#x5219;&#x6570;&#x636E;&#x4F1A;&#x88AB;&#x5199;&#x5165;&#x5F53;&#x524D;&#x7684;&#x4F4D;&#x7F6E;&#x3002;
  &#x53C2;&#x89C1; <a href="/s/2qJ9AM" rel="nofollow"><code>pwrite(2)</code></a>&#x3002;</p>
  <p>&#x56DE;&#x8C03;&#x6709;&#x4E09;&#x4E2A;&#x53C2;&#x6570; <code>(err, bytesWritten, buffer)</code>&#xFF0C;&#x5176;&#x4E2D; <code>bytesWritten</code> &#x6307;&#x5B9A;&#x4ECE; <code>buffer</code> &#x4E2D;&#x88AB;&#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x8C03;&#x7528;&#x6B64;&#x65B9;&#x6CD5;&#x7684; <a href="/s/DGMNHh" rel="nofollow"><code>util.promisify()</code></a> &#x7248;&#x672C;&#xFF0C;&#x5219;&#x8FD4;&#x56DE; <code>Promise</code>&#xFF08;&#x4F1A;&#x4F20;&#x5165;&#x5177;&#x6709; <code>bytesWritten</code> &#x548C; <code>buffer</code> &#x5C5E;&#x6027;&#x7684; <code>Object</code>&#xFF09;&#x3002;</p>
  <p>&#x4E0D;&#x7B49;&#x5F85;&#x56DE;&#x8C03;&#x5C31;&#x5BF9;&#x540C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x591A;&#x6B21;&#x4F7F;&#x7528; <code>fs.write()</code> &#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#x3002;
  &#x5BF9;&#x4E8E;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528; <a href="/s/VdSJQa" rel="nofollow"><code>fs.createWriteStream()</code></a>&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53;&#x4EE5;&#x8FFD;&#x52A0;&#x6A21;&#x5F0F;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x65F6;&#xFF0C;&#x5219;&#x5199;&#x5165;&#x65F6;&#x65E0;&#x6CD5;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x3002;
  &#x5185;&#x6838;&#x4F1A;&#x5FFD;&#x7565;&#x4F4D;&#x7F6E;&#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x59CB;&#x7EC8;&#x8FFD;&#x52A0;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#x7684;&#x672B;&#x5C3E;&#x3002;</p>
  <h2><code>fs.write(fd, string[, position[, encoding]], callback)</code><span><a class="mark" href="#fs_fs_write_fd_string_position_encoding_callback" id="fs_fs_write_fd_string_position_encoding_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_write_fd_string_position_encoding_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_write_fd_string_position_encoding_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>The <code>string</code> parameter won&apos;t coerce unsupported input to strings anymore.</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.2.0</td>
  <td><p>The <code>position</code> parameter is optional now.</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v0.11.5</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.11.5</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>string</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>written</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>string</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5C06; <code>string</code> &#x5199;&#x5165;&#x5230; <code>fd</code> &#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x3002;
  &#x5982;&#x679C; <code>string</code> &#x4E0D;&#x662F;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x4F1A;&#x629B;&#x51FA;&#x5F02;&#x5E38;&#x3002;</p>
  <p><code>position</code> &#x6307;&#x5B9A;&#x6587;&#x4EF6;&#x5F00;&#x5934;&#x7684;&#x504F;&#x79FB;&#x91CF;&#xFF08;&#x6570;&#x636E;&#x8981;&#x88AB;&#x5199;&#x5165;&#x7684;&#x4F4D;&#x7F6E;&#xFF09;&#x3002;
  &#x5982;&#x679C; <code>typeof position !== &apos;number&apos;</code>&#xFF0C;&#x5219;&#x6570;&#x636E;&#x4F1A;&#x88AB;&#x5199;&#x5165;&#x5F53;&#x524D;&#x7684;&#x4F4D;&#x7F6E;&#x3002;
  &#x53C2;&#x89C1; <a href="/s/2qJ9AM" rel="nofollow"><code>pwrite(2)</code></a>&#x3002;</p>
  <p><code>encoding</code> &#x662F;&#x671F;&#x671B;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x7F16;&#x7801;&#x3002;</p>
  <p>&#x56DE;&#x8C03;&#x4F1A;&#x63A5;&#x6536;&#x5230;&#x53C2;&#x6570; <code>(err, written, string)</code>&#xFF0C;&#x5176;&#x4E2D; <code>written</code> &#x6307;&#x5B9A;&#x4F20;&#x5165;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x88AB;&#x8981;&#x6C42;&#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;
  &#x88AB;&#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x4E0D;&#x4E00;&#x5B9A;&#x4E0E;&#x88AB;&#x5199;&#x5165;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x5B57;&#x7B26;&#x6570;&#x76F8;&#x540C;&#x3002;
  &#x53C2;&#x89C1; <a href="/s/E4ygXT" rel="nofollow"><code>Buffer.byteLength</code></a>&#x3002;</p>
  <p>&#x4E0D;&#x7B49;&#x5F85;&#x56DE;&#x8C03;&#x5C31;&#x5BF9;&#x540C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x591A;&#x6B21;&#x4F7F;&#x7528; <code>fs.write()</code> &#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#x3002;
  &#x5BF9;&#x4E8E;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528; <a href="/s/VdSJQa" rel="nofollow"><code>fs.createWriteStream()</code></a>&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53;&#x4EE5;&#x8FFD;&#x52A0;&#x6A21;&#x5F0F;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x65F6;&#xFF0C;&#x5219;&#x5199;&#x5165;&#x65F6;&#x65E0;&#x6CD5;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x3002;
  &#x5185;&#x6838;&#x4F1A;&#x5FFD;&#x7565;&#x4F4D;&#x7F6E;&#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x59CB;&#x7EC8;&#x8FFD;&#x52A0;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#x7684;&#x672B;&#x5C3E;&#x3002;</p>
  <p>&#x5728; Windows &#x4E0A;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x8FDE;&#x63A5;&#x5230;&#x63A7;&#x5236;&#x53F0;&#xFF08;&#x4F8B;&#x5982; <code>fd == 1</code> &#x6216; <code>stdout</code>&#xFF09;&#xFF0C;&#x5219;&#x65E0;&#x8BBA;&#x4F7F;&#x7528;&#x4F55;&#x79CD;&#x7F16;&#x7801;&#xFF0C;&#x5305;&#x542B;&#x975E; ASCII &#x5B57;&#x7B26;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x90FD;&#x4E0D;&#x4F1A;&#x88AB;&#x6B63;&#x786E;&#x5730;&#x6E32;&#x67D3;&#x3002;
  &#x901A;&#x8FC7;&#x4F7F;&#x7528; <code>chcp 65001</code> &#x547D;&#x4EE4;&#x66F4;&#x6539;&#x6D3B;&#x52A8;&#x7684;&#x4EE3;&#x7801;&#x9875;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06;&#x63A7;&#x5236;&#x53F0;&#x914D;&#x7F6E;&#x4E3A;&#x6B63;&#x786E;&#x5730;&#x6E32;&#x67D3; UTF-8&#x3002;
  &#x8BE6;&#x89C1; <a href="/s/NAMZkR" rel="nofollow">chcp</a> &#x6587;&#x6863;&#x3002;</p>
  <h2><code>fs.writeFile(file, data[, options], callback)</code><span><a class="mark" href="#fs_fs_writefile_file_data_options_callback" id="fs_fs_writefile_file_data_options_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_writefile_file_data_options_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_writefile_file_data_options_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>data</code> &#x4E0D;&#x518D;&#x5F3A;&#x5236;&#x8F6C;&#x6362;&#x4E0D;&#x652F;&#x6301;&#x7684;&#x8F93;&#x5165;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p></td></tr>
  <tr><td>v10.10.0</td>
  <td><p>&#x53C2;&#x6570; <code>data</code> &#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x4F55;&#x7684; <code>TypedArray</code> &#x6216; <code>DataView</code>&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x629B;&#x51FA; <code>TypeError</code>&#x3002;</p></td></tr>
  <tr><td>v7.4.0</td>
  <td><p>&#x53C2;&#x6570; <code>data</code> &#x53EF;&#x4EE5;&#x662F; <code>Uint8Array</code>&#x3002;</p></td></tr>
  <tr><td>v7.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>callback</code> &#x4E0D;&#x518D;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5982;&#x679C;&#x4E0D;&#x4F20;&#x5165;&#xFF0C;&#x5219;&#x4F1A;&#x89E6;&#x53D1;&#x5F03;&#x7528;&#x8B66;&#x544A;&#xFF08;id &#x4E3A; DEP0013&#xFF09;&#x3002;</p></td></tr>
  <tr><td>v5.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>file</code> &#x53EF;&#x4EE5;&#x662F;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</p></td></tr>
  <tr><td>v0.1.29</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.29</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>file</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x6587;&#x4EF6;&#x540D;&#x6216;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  <li><code>data</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/oh3CkV" target="_blank" rel="nofollow" class="type">&lt;TypedArray&gt;</a> | <a href="/s/yCdVkD" target="_blank" rel="nofollow" class="type">&lt;DataView&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#x3002;</li>
  <li><code>flag</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;w&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x5F53; <code>file</code> &#x662F;&#x6587;&#x4EF6;&#x540D;&#x65F6;&#xFF0C;&#x5219;&#x5F02;&#x6B65;&#x5730;&#x5199;&#x5165;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#xFF08;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5DF2;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x8986;&#x76D6;&#x6587;&#x4EF6;&#xFF09;&#x3002;
  <code>data</code> &#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x6216; buffer&#x3002;</p>
  <p>&#x5F53; <code>file</code> &#x662F;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x65F6;&#xFF0C;&#x5219;&#x5176;&#x884C;&#x4E3A;&#x7C7B;&#x4F3C;&#x4E8E;&#x76F4;&#x63A5;&#x8C03;&#x7528; <code>fs.write()</code>&#xFF08;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528;&#xFF09;&#x3002;
  &#x53C2;&#x89C1;&#x4EE5;&#x4E0B;&#x5173;&#x4E8E;&#x4F7F;&#x7528;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x7684;&#x8BF4;&#x660E;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>data</code> &#x662F; buffer&#xFF0C;&#x5219; <code>encoding</code> &#x9009;&#x9879;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> data = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Uint8Array</span>(Buffer.from(<span class="hljs-string">&apos;Node.js &#x4E2D;&#x6587;&#x7F51;&apos;</span>));
  fs.writeFile(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, data, (err) =&gt; {
    <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6587;&#x4EF6;&#x5DF2;&#x88AB;&#x4FDD;&#x5B58;&apos;</span>);
  });</code></pre>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF1A;</p>
  <pre><code class="language-js">fs.writeFile(<span class="hljs-string">&apos;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;Node.js &#x4E2D;&#x6587;&#x7F51;&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>, callback);</code></pre>
  <p>&#x4E0D;&#x7B49;&#x5F85;&#x56DE;&#x8C03;&#x5C31;&#x5BF9;&#x540C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x591A;&#x6B21;&#x4F7F;&#x7528; <code>fs.writeFile()</code> &#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#x3002;
  &#x5BF9;&#x4E8E;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528; <a href="/s/VdSJQa" rel="nofollow"><code>fs.createWriteStream()</code></a>&#x3002;</p>
  <h3>&#x4F7F;&#x7528; fs.writeFile() &#x4E0E;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;<span><a class="mark" href="#fs_using_fs_writefile_with_file_descriptors" id="fs_using_fs_writefile_with_file_descriptors">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/using_fs_writefile_with_file_descriptors.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/using_fs_writefile_with_file_descriptors.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x5F53; <code>file</code> &#x662F;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x65F6;&#xFF0C;&#x884C;&#x4E3A;&#x51E0;&#x4E4E;&#x4E0E;&#x76F4;&#x63A5;&#x8C03;&#x7528; <code>fs.write()</code> &#x7C7B;&#x4F3C;&#xFF1A;</p>
  <pre><code class="language-js">fs.write(fd, Buffer.from(data, options.encoding), callback);</code></pre>
  <p>&#x4E0E;&#x76F4;&#x63A5;&#x8C03;&#x7528; <code>fs.write()</code> &#x7684;&#x533A;&#x522B;&#x5728;&#x4E8E;&#xFF0C;&#x5728;&#x67D0;&#x4E9B;&#x5F02;&#x5E38;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C; <code>fs.write()</code> &#x53EF;&#x80FD;&#x53EA;&#x5199;&#x5165;&#x90E8;&#x5206; buffer&#xFF0C;&#x9700;&#x8981;&#x91CD;&#x8BD5;&#x4EE5;&#x5199;&#x5165;&#x5269;&#x4F59;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x800C; <code>fs.writeFile()</code> &#x5C06;&#x4F1A;&#x91CD;&#x8BD5;&#x76F4;&#x5230;&#x6570;&#x636E;&#x5B8C;&#x5168;&#x5199;&#x5165;&#xFF08;&#x6216;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#xFF09;&#x3002;</p>
  <p>&#x8FD9;&#x79CD;&#x5F71;&#x54CD;&#x662F;&#x6DF7;&#x6DC6;&#x7684;&#x5E38;&#x89C1;&#x539F;&#x56E0;&#x3002;
  &#x5728;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6587;&#x4EF6;&#x4E0D;&#x4F1A;&#x88AB;&#x66FF;&#x6362;&#xFF01;
  &#x6570;&#x636E;&#x4E0D;&#x4E00;&#x5B9A;&#x5199;&#x5165;&#x5230;&#x6587;&#x4EF6;&#x7684;&#x5F00;&#x5934;&#xFF0C;&#x6587;&#x4EF6;&#x7684;&#x539F;&#x59CB;&#x6570;&#x636E;&#x53EF;&#x4EE5;&#x4FDD;&#x7559;&#x5728;&#x65B0;&#x5199;&#x5165;&#x7684;&#x6570;&#x636E;&#x4E4B;&#x524D;&#x548C;/&#x6216;&#x4E4B;&#x540E;&#x3002;</p>
  <p>&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x8FDE;&#x7EED;&#x4E24;&#x6B21;&#x8C03;&#x7528; <code>fs.writeFile()</code>&#xFF0C;&#x9996;&#x5148;&#x5199;&#x5165;&#x5B57;&#x7B26;&#x4E32; <code>&apos;Hello&apos;</code>&#xFF0C;&#x7136;&#x540E;&#x5199;&#x5165;&#x5B57;&#x7B26;&#x4E32; <code>&apos;, World&apos;</code>&#xFF0C;&#x5219;&#x8BE5;&#x6587;&#x4EF6;&#x5C06;&#x4F1A;&#x5305;&#x542B; <code>&apos;Hello, World&apos;</code>&#xFF0C;&#x5E76;&#x4E14;&#x53EF;&#x80FD;&#x5305;&#x542B;&#x6587;&#x4EF6;&#x7684;&#x4E00;&#x4E9B;&#x539F;&#x59CB;&#x6570;&#x636E;&#xFF08;&#x53D6;&#x51B3;&#x4E8E;&#x539F;&#x59CB;&#x6587;&#x4EF6;&#x7684;&#x5927;&#x5C0F;&#x548C;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x7684;&#x4F4D;&#x7F6E;&#xFF09;&#x3002;
  &#x5982;&#x679C;&#x4F7F;&#x7528;&#x4E86;&#x6587;&#x4EF6;&#x540D;&#x800C;&#x4E0D;&#x662F;&#x63CF;&#x8FF0;&#x7B26;&#xFF0C;&#x5219;&#x8BE5;&#x6587;&#x4EF6;&#x5C06;&#x4F1A;&#x4FDD;&#x8BC1;&#x4EC5;&#x5305;&#x542B; <code>&apos;, World&apos;</code>&#x3002;</p>
  <h2><code>fs.writeFileSync(file, data[, options])</code><span><a class="mark" href="#fs_fs_writefilesync_file_data_options" id="fs_fs_writefilesync_file_data_options">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_writefilesync_file_data_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_writefilesync_file_data_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>data</code> &#x4E0D;&#x518D;&#x5F3A;&#x5236;&#x8F6C;&#x6362;&#x4E0D;&#x652F;&#x6301;&#x7684;&#x8F93;&#x5165;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p></td></tr>
  <tr><td>v10.10.0</td>
  <td><p>&#x53C2;&#x6570; <code>data</code> &#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x4F55;&#x7684; <code>TypedArray</code> &#x6216; <code>DataView</code>&#x3002;</p></td></tr>
  <tr><td>v7.4.0</td>
  <td><p>&#x53C2;&#x6570; <code>data</code> &#x53EF;&#x4EE5;&#x662F; <code>Uint8Array</code>&#x3002;</p></td></tr>
  <tr><td>v5.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>file</code> &#x53EF;&#x4EE5;&#x662F;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</p></td></tr>
  <tr><td>v0.1.29</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.29</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>file</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x6587;&#x4EF6;&#x540D;&#x6216;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  <li><code>data</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/oh3CkV" target="_blank" rel="nofollow" class="type">&lt;TypedArray&gt;</a> | <a href="/s/yCdVkD" target="_blank" rel="nofollow" class="type">&lt;DataView&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#x3002;</li>
  <li><code>flag</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;w&apos;</code>&#x3002;</li>
  </ul>
  </li>
  </ul>
  <p>&#x8FD4;&#x56DE; <code>undefined</code>&#x3002;</p>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/rnLrUA" rel="nofollow"><code>fs.writeFile()</code></a>&#x3002;</p>
  <h2><code>fs.writeSync(fd, buffer[, offset[, length[, position]]])</code><span><a class="mark" href="#fs_fs_writesync_fd_buffer_offset_length_position" id="fs_fs_writesync_fd_buffer_offset_length_position">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_writesync_fd_buffer_offset_length_position.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_writesync_fd_buffer_offset_length_position.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>buffer</code> &#x4E0D;&#x518D;&#x5F3A;&#x5236;&#x628A;&#x4E0D;&#x652F;&#x6301;&#x7684;&#x8F93;&#x5165;&#x8F6C;&#x6362;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p></td></tr>
  <tr><td>v10.10.0</td>
  <td><p>&#x53C2;&#x6570; <code>buffer</code> &#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x4F55; <code>TypedArray</code> &#x6216; <code>DataView</code>&#x3002;</p></td></tr>
  <tr><td>v7.4.0</td>
  <td><p>&#x53C2;&#x6570; <code>buffer</code> &#x53EF;&#x4EE5;&#x662F; <code>Uint8Array</code>&#x3002;</p></td></tr>
  <tr><td>v7.2.0</td>
  <td><p>&#x53C2;&#x6570; <code>offset</code> &#x548C; <code>length</code> &#x662F;&#x53EF;&#x9009;&#x7684;&#x3002;</p></td></tr>
  <tr><td>v0.1.21</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.1.21</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/oh3CkV" target="_blank" rel="nofollow" class="type">&lt;TypedArray&gt;</a> | <a href="/s/yCdVkD" target="_blank" rel="nofollow" class="type">&lt;DataView&gt;</a></li>
  <li><code>offset</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>length</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</li>
  </ul>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/tcfaJD" rel="nofollow"><code>fs.write(fd, buffer...)</code></a>&#x3002;</p>
  <h2><code>fs.writeSync(fd, string[, position[, encoding]])</code><span><a class="mark" href="#fs_fs_writesync_fd_string_position_encoding" id="fs_fs_writesync_fd_string_position_encoding">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_writesync_fd_string_position_encoding.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_writesync_fd_string_position_encoding.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>The <code>string</code> parameter won&apos;t coerce unsupported input to strings anymore.</p></td></tr>
  <tr><td>v7.2.0</td>
  <td><p>The <code>position</code> parameter is optional now.</p></td></tr>
  <tr><td>v0.11.5</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v0.11.5</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>string</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</li>
  </ul>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A; <a href="/s/hJ75C3" rel="nofollow"><code>fs.write(fd, string...)</code></a>&#x3002;</p>
  <h2><code>fs.writev(fd, buffers[, position], callback)</code><span><a class="mark" href="#fs_fs_writev_fd_buffers_position_callback" id="fs_fs_writev_fd_buffers_position_callback">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_writev_fd_buffers_position_callback.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_writev_fd_buffers_position_callback.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.9.0</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffers</code> <a href="/s/qijt55" target="_blank" rel="nofollow" class="type">&lt;ArrayBufferView[]&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>
  <p><code>callback</code> <a href="/s/ceTQa6" target="_blank" rel="nofollow" class="type">&lt;Function&gt;</a></p>
  <ul>
  <li><code>err</code> <a href="/s/qZ873x" target="_blank" rel="nofollow" class="type">&lt;Error&gt;</a></li>
  <li><code>bytesWritten</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffers</code> <a href="/s/qijt55" target="_blank" rel="nofollow" class="type">&lt;ArrayBufferView[]&gt;</a></li>
  </ul>
  </li>
  </ul>
  <p>&#x4F7F;&#x7528; <code>writev()</code> &#x5C06;&#x4E00;&#x4E2A; <code>ArrayBufferView</code> &#x6570;&#x7EC4;&#x5199;&#x5165; <code>fd</code> &#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x3002;</p>
  <p><code>position</code> &#x6307;&#x5B9A;&#x6587;&#x4EF6;&#x5F00;&#x5934;&#x7684;&#x504F;&#x79FB;&#x91CF;&#xFF08;&#x6570;&#x636E;&#x8981;&#x88AB;&#x5199;&#x5165;&#x7684;&#x4F4D;&#x7F6E;&#xFF09;&#x3002;
  &#x5982;&#x679C; <code>typeof position !== &apos;number&apos;</code>&#xFF0C;&#x5219;&#x6570;&#x636E;&#x4F1A;&#x88AB;&#x5199;&#x5165;&#x5F53;&#x524D;&#x7684;&#x4F4D;&#x7F6E;&#x3002; </p>
  <p>&#x56DE;&#x8C03;&#x6709;&#x4E09;&#x4E2A;&#x53C2;&#x6570;&#xFF1A;<code>err</code>&#x3001; <code>bytesWritten</code> &#x548C; <code>buffers</code>&#x3002;
  <code>bytesWritten</code> &#x662F;&#x4ECE; <code>buffers</code> &#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x6B64;&#x65B9;&#x6CD5;&#x662F; <a href="/s/DGMNHh" rel="nofollow"><code>util.promisify()</code></a> &#x5316;&#x7684;&#x7248;&#x672C;&#xFF0C;&#x5219;&#x5B83;&#x8FD4;&#x56DE;&#x7684; <code>Promise</code> &#x4F1A;&#x8FD4;&#x56DE;&#x5177;&#x6709; <code>bytesWritten</code> &#x548C; <code>buffers</code> &#x5C5E;&#x6027;&#x7684; <code>Object</code>&#x3002;</p>
  <p>&#x4E0D;&#x7B49;&#x5F85;&#x56DE;&#x8C03;&#x5C31;&#x5BF9;&#x540C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x591A;&#x6B21;&#x4F7F;&#x7528; <code>fs.writev()</code> &#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#x3002;
  &#x5BF9;&#x4E8E;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528; <a href="/s/VdSJQa" rel="nofollow"><code>fs.createWriteStream()</code></a>&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53;&#x4EE5;&#x8FFD;&#x52A0;&#x6A21;&#x5F0F;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x65F6;&#xFF0C;&#x5219;&#x5199;&#x5165;&#x65F6;&#x65E0;&#x6CD5;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x3002;
  &#x5185;&#x6838;&#x4F1A;&#x5FFD;&#x7565;&#x4F4D;&#x7F6E;&#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x59CB;&#x7EC8;&#x8FFD;&#x52A0;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#x7684;&#x672B;&#x5C3E;&#x3002;</p>
  <h2><code>fs.writevSync(fd, buffers[, position])</code><span><a class="mark" href="#fs_fs_writevsync_fd_buffers_position" id="fs_fs_writevsync_fd_buffers_position">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_writevsync_fd_buffers_position.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_writevsync_fd_buffers_position.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.9.0</span>
  </div>
  <ul>
  <li><code>fd</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>buffers</code> <a href="/s/qijt55" target="_blank" rel="nofollow" class="type">&lt;ArrayBufferView[]&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</li>
  </ul>
  <p>&#x8BE6;&#x89C1;&#x6B64; API &#x7684;&#x5F02;&#x6B65;&#x7248;&#x672C;&#x7684;&#x6587;&#x6863;&#xFF1A;<a href="/s/nijKez" rel="nofollow"><code>fs.writev()</code></a>&#x3002;</p>
  <h2>fs &#x7684; Promise API<span><a class="mark" href="#fs_fs_promises_api" id="fs_fs_promises_api">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_promises_api.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_promises_api.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p><code>fs.promises</code> API &#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x7EC4;&#x5907;&#x7528;&#x7684;&#x5F02;&#x6B65;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x5B83;&#x4EEC;&#x8FD4;&#x56DE; <code>Promise</code> &#x5BF9;&#x8C61;&#x800C;&#x4E0D;&#x662F;&#x4F7F;&#x7528;&#x56DE;&#x8C03;&#x3002;
  API &#x53EF;&#x901A;&#x8FC7; <code>require(&apos;fs&apos;).promises</code> &#x6216; <code>require(&apos;fs/promises&apos;)</code> &#x8BBF;&#x95EE;&#x3002;</p>
  <h3>FileHandle &#x7C7B;<span><a class="mark" href="#fs_class_filehandle" id="fs_class_filehandle">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/class_filehandle.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/class_filehandle.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <p><code>FileHandle</code> &#x5BF9;&#x8C61;&#x662F;&#x6570;&#x5B57;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x7684;&#x5305;&#x88C5;&#x5668;&#x3002;
  <code>FileHandle</code> &#x7684;&#x5B9E;&#x4F8B;&#x4E0E;&#x6570;&#x5B57;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x7684;&#x4E0D;&#x540C;&#x4E4B;&#x5904;&#x5728;&#x4E8E;&#x5B83;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x7684; API &#x6765;&#x5904;&#x7406;&#x6587;&#x4EF6;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x6CA1;&#x6709;&#x4F7F;&#x7528; <code>filehandle.close()</code> &#x65B9;&#x6CD5;&#x5173;&#x95ED; <code>FileHandle</code>&#xFF0C;&#x5219;&#x5B83;&#x53EF;&#x80FD;&#x4F1A;&#x81EA;&#x52A8;&#x5173;&#x95ED;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x5E76;&#x89E6;&#x53D1;&#x8FDB;&#x7A0B;&#x8B66;&#x544A;&#xFF0C;&#x4ECE;&#x800C;&#x6709;&#x52A9;&#x4E8E;&#x9632;&#x6B62;&#x5185;&#x5B58;&#x6CC4;&#x6F0F;&#x3002;
  &#x8BF7;&#x4E0D;&#x8981;&#x5728;&#x4EE3;&#x7801;&#x4E2D;&#x4F9D;&#x8D56;&#x6B64;&#x884C;&#x4E3A;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x4E0D;&#x53EF;&#x9760;&#xFF0C;&#x4E14;&#x8BE5;&#x6587;&#x4EF6;&#x53EF;&#x80FD;&#x65E0;&#x6CD5;&#x5173;&#x95ED;&#x3002;
  &#x76F8;&#x53CD;&#xFF0C;&#x5E94;&#x8BE5;&#x59CB;&#x7EC8;&#x663E;&#x5F0F;&#x7684;&#x5173;&#x95ED; <code>FileHandles</code>&#x3002;
  Node.js &#x5C06;&#x6765;&#x53EF;&#x80FD;&#x4F1A;&#x6539;&#x53D8;&#x8FD9;&#x79CD;&#x884C;&#x4E3A;&#x3002;</p>
  <p><code>FileHandle</code> &#x5BF9;&#x8C61;&#x7684;&#x5B9E;&#x4F8B;&#x7531; <code>fsPromises.open()</code> &#x65B9;&#x6CD5;&#x5728;&#x5185;&#x90E8;&#x521B;&#x5EFA;&#x3002;</p>
  <p>&#x4E0E;&#x57FA;&#x4E8E;&#x56DE;&#x8C03;&#x7684; API&#xFF08;&#x5982; <code>fs.fstat()</code>&#x3001; <code>fs.fchown()</code>&#x3001; <code>fs.fchmod()</code> &#x7B49;&#xFF09;&#x4E0D;&#x540C;&#xFF0C;&#x57FA;&#x4E8E; promise &#x7684; API &#x4E0D;&#x4F7F;&#x7528;&#x6570;&#x5B57;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;
  &#x800C;&#x662F;&#xFF0C;&#x57FA;&#x4E8E; promise &#x7684; API &#x4F7F;&#x7528; <code>FileHandle</code> &#x7C7B;&#xFF0C;&#x4EE5;&#x5E2E;&#x52A9;&#x907F;&#x514D;&#x5728;&#x89E3;&#x51B3;&#x6216;&#x62D2;&#x7EDD; <code>Promise</code> &#x540E;&#x610F;&#x5916;&#x6CC4;&#x6F0F;&#x672A;&#x5173;&#x95ED;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</p>
  <h4><code>filehandle.appendFile(data, options)</code><span><a class="mark" href="#fs_filehandle_appendfile_data_options" id="fs_filehandle_appendfile_data_options">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_appendfile_data_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_appendfile_data_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>data</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p><a href="/s/o1g7Bj" rel="nofollow"><code>filehandle.writeFile()</code></a> &#x7684;&#x522B;&#x540D;&#x3002;</p>
  <p>&#x5F53;&#x5728;&#x6587;&#x4EF6;&#x53E5;&#x67C4;&#x4E0A;&#x8FDB;&#x884C;&#x64CD;&#x4F5C;&#x65F6;&#xFF0C;&#x65E0;&#x6CD5;&#x5C06;&#x6A21;&#x5F0F;&#x66F4;&#x6539;&#x4E3A;&#x4F7F;&#x7528; <a href="/s/4Q9rYG" rel="nofollow"><code>fsPromises.open()</code></a> &#x8BBE;&#x7F6E;&#x7684;&#x6A21;&#x5F0F;&#x3002;
  &#x56E0;&#x6B64;&#xFF0C;&#x8FD9;&#x7B49;&#x6548;&#x4E8E; <a href="/s/o1g7Bj" rel="nofollow"><code>filehandle.writeFile()</code></a>&#x3002;</p>
  <h4><code>filehandle.chmod(mode)</code><span><a class="mark" href="#fs_filehandle_chmod_mode" id="fs_filehandle_chmod_mode">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_chmod_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_chmod_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x6743;&#x9650;&#x3002;
  <code>Promise</code> &#x5C06;&#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <h4><code>filehandle.chown(uid, gid)</code><span><a class="mark" href="#fs_filehandle_chown_uid_gid" id="fs_filehandle_chown_uid_gid">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_chown_uid_gid.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_chown_uid_gid.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>uid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>gid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x6240;&#x6709;&#x8005;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <h4><code>filehandle.close()</code><span><a class="mark" href="#fs_filehandle_close" id="fs_filehandle_close">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_close.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_close.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a> &#x5982;&#x679C;&#x5E95;&#x5C42;&#x7684;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x88AB;&#x5173;&#x95ED;&#x5219; <code>Promise</code> &#x5C06;&#x4F1A;&#x88AB;&#x89E3;&#x51B3;&#xFF0C;&#x5982;&#x679C;&#x5173;&#x95ED;&#x65F6;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#x5219;&#x5C06; <code>Promise</code> &#x5C06;&#x4F1A;&#x88AB;&#x62D2;&#x7EDD;&#x3002;
  &#x5173;&#x95ED;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  </ul>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fsPromises = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>).promises;
  <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">openAndClose</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">let</span> filehandle;
    <span class="hljs-keyword">try</span> {
      filehandle = <span class="hljs-keyword">await</span> fsPromises.open(<span class="hljs-string">&apos;thefile.txt&apos;</span>, <span class="hljs-string">&apos;r&apos;</span>);
    } <span class="hljs-keyword">finally</span> {
      <span class="hljs-keyword">if</span> (filehandle !== <span class="hljs-literal">undefined</span>)
        <span class="hljs-keyword">await</span> filehandle.close();
    }
  }</code></pre>
  <h4><code>filehandle.datasync()</code><span><a class="mark" href="#fs_filehandle_datasync" id="fs_filehandle_datasync">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_datasync.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_datasync.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/AEp6fv" rel="nofollow"><code>fdatasync(2)</code></a>&#x3002;
  <code>Promise</code> &#x5C06;&#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <h4><code>filehandle.fd</code><span><a class="mark" href="#fs_filehandle_fd" id="fs_filehandle_fd">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_fd.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_fd.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x7531; <code>FileHandle</code> &#x5BF9;&#x8C61;&#x7BA1;&#x7406;&#x7684;&#x6570;&#x5B57;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x3002;</li>
  </ul>
  <h4><code>filehandle.read(buffer, offset, length, position)</code><span><a class="mark" href="#fs_filehandle_read_buffer_offset_length_position" id="fs_filehandle_read_buffer_offset_length_position">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_read_buffer_offset_length_position.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_read_buffer_offset_length_position.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/ZbDkpm" target="_blank" rel="nofollow" class="type">&lt;Uint8Array&gt;</a></li>
  <li><code>offset</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>length</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x4ECE;&#x6587;&#x4EF6;&#x4E2D;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#x3002;</p>
  <p><code>buffer</code> &#x662F;&#x6570;&#x636E;&#x5C06;&#x5199;&#x5165;&#x7684;&#x7F13;&#x51B2;&#x533A;&#x3002;</p>
  <p><code>offset</code> &#x662F; buffer &#x4E2D;&#x5F00;&#x59CB;&#x5199;&#x5165;&#x7684;&#x504F;&#x79FB;&#x91CF;&#x3002;</p>
  <p><code>length</code> &#x662F;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x8981;&#x8BFB;&#x53D6;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</p>
  <p><code>position</code> &#x53C2;&#x6570;&#x6307;&#x5B9A;&#x4ECE;&#x6587;&#x4EF6;&#x4E2D;&#x5F00;&#x59CB;&#x8BFB;&#x53D6;&#x7684;&#x4F4D;&#x7F6E;&#x3002;
  &#x5982;&#x679C; <code>position</code> &#x4E3A; <code>null</code>&#xFF0C;&#x5219;&#x4ECE;&#x5F53;&#x524D;&#x6587;&#x4EF6;&#x4F4D;&#x7F6E;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#xFF0C;&#x5E76;&#x66F4;&#x65B0;&#x6587;&#x4EF6;&#x4F4D;&#x7F6E;&#x3002;
  &#x5982;&#x679C; <code>position</code> &#x662F;&#x6574;&#x6570;&#xFF0C;&#x5219;&#x6587;&#x4EF6;&#x4F4D;&#x7F6E;&#x4F1A;&#x4FDD;&#x6301;&#x4E0D;&#x53D8;&#x3002;</p>
  <p>&#x6210;&#x529F;&#x8BFB;&#x53D6;&#x4E4B;&#x540E;&#xFF0C; <code>Promise</code> &#x4F1A;&#x88AB;&#x89E3;&#x51B3;&#x5E76;&#x5E26;&#x4E0A;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5BF9;&#x8C61;&#x4E0A;&#x6709;&#x4E00;&#x4E2A; <code>bytesRead</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x8BFB;&#x53D6;&#x7684;&#x5B57;&#x8282;&#x6570;&#xFF09;&#x548C;&#x4E00;&#x4E2A; <code>buffer</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5411;&#x4F20;&#x5165;&#x7684; <code>buffer</code> &#x53C2;&#x6570;&#xFF09;&#x3002;</p>
  <h4><code>filehandle.read(options)</code><span><a class="mark" href="#fs_filehandle_read_options" id="fs_filehandle_read_options">#</a></span></h4><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_read_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v13.11.0</span>
  </div>
  <ul>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/ZbDkpm" target="_blank" rel="nofollow" class="type">&lt;Uint8Array&gt;</a> <strong>Default:</strong> <code>Buffer.alloc(16384)</code></li>
  <li><code>offset</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>Default:</strong> <code>0</code></li>
  <li><code>length</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>Default:</strong> <code>buffer.length</code></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>Default:</strong> <code>null</code></li>
  </ul>
  </li>
  <li>Returns: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <h4><code>filehandle.readFile(options)</code><span><a class="mark" href="#fs_filehandle_readfile_options" id="fs_filehandle_readfile_options">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_readfile_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_readfile_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>null</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x8BFB;&#x53D6;&#x6587;&#x4EF6;&#x7684;&#x5168;&#x90E8;&#x5185;&#x5BB9;&#x3002;</p>
  <p><code>Promise</code> &#x88AB;&#x89E3;&#x51B3;&#x65F6;&#x4F1A;&#x5E26;&#x4E0A;&#x6587;&#x4EF6;&#x7684;&#x5185;&#x5BB9;&#x3002;
  &#x5982;&#x679C;&#x6CA1;&#x6709;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF08;&#x4F7F;&#x7528; <code>options.encoding</code>&#xFF09;&#xFF0C;&#x5219;&#x6570;&#x636E;&#x4F1A;&#x4EE5; <code>Buffer</code> &#x5BF9;&#x8C61;&#x8FD4;&#x56DE;&#x3002;
  &#x5426;&#x5219;&#xFF0C;&#x6570;&#x636E;&#x5C06;&#x4F1A;&#x662F;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <p><code>FileHandle</code> &#x5FC5;&#x987B;&#x652F;&#x6301;&#x8BFB;&#x53D6;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x5BF9;&#x6587;&#x4EF6;&#x53E5;&#x67C4;&#x8FDB;&#x884C;&#x4E86;&#x4E00;&#x6B21;&#x6216;&#x591A;&#x6B21; <code>filehandle.read()</code> &#x8C03;&#x7528;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x8C03;&#x7528; <code>filehandle.readFile()</code>&#xFF0C;&#x5219;&#x5C06;&#x4ECE;&#x5F53;&#x524D;&#x4F4D;&#x7F6E;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#xFF0C;&#x76F4;&#x5230;&#x6587;&#x4EF6;&#x7ED3;&#x675F;&#x3002;
  &#x5B83;&#x5E76;&#x4E0D;&#x603B;&#x662F;&#x4ECE;&#x6587;&#x4EF6;&#x7684;&#x5F00;&#x5934;&#x8BFB;&#x53D6;&#x3002;</p>
  <h4><code>filehandle.readv(buffers[, position])</code><span><a class="mark" href="#fs_filehandle_readv_buffers_position" id="fs_filehandle_readv_buffers_position">#</a></span></h4><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_readv_buffers_position.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.0.0</span>
  </div>
  <ul>
  <li><code>buffers</code> <a href="/s/qijt55" target="_blank" rel="nofollow" class="type">&lt;ArrayBufferView[]&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>Returns: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>Read from a file and write to an array of <code>ArrayBufferView</code>s</p>
  <p>The <code>Promise</code> is resolved with an object containing a <code>bytesRead</code> property
  identifying the number of bytes read, and a <code>buffers</code> property containing
  a reference to the <code>buffers</code> input.</p>
  <p><code>position</code> is the offset from the beginning of the file where this data
  should be read from. If <code>typeof position !== &apos;number&apos;</code>, the data will be read
  from the current position.</p>
  <h4><code>filehandle.stat([options])</code><span><a class="mark" href="#fs_filehandle_stat_options" id="fs_filehandle_stat_options">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_stat_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_stat_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>&#x63A5;&#x53D7;&#x989D;&#x5916;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; bigint&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x8FD4;&#x56DE;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x5E94;&#x4E3A; <code>bigint</code> &#x578B;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x68C0;&#x7D22;&#x6587;&#x4EF6;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a>&#x3002;</p>
  <h4><code>filehandle.sync()</code><span><a class="mark" href="#fs_filehandle_sync" id="fs_filehandle_sync">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_sync.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_sync.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/d4u3Ks" rel="nofollow"><code>fsync(2)</code></a>&#x3002;
  <code>Promise</code> &#x5C06;&#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <h4><code>filehandle.truncate(len)</code><span><a class="mark" href="#fs_filehandle_truncate_len" id="fs_filehandle_truncate_len">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_truncate_len.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_truncate_len.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>len</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x622A;&#x65AD;&#x6587;&#x4EF6;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5927;&#x4E8E; <code>len</code> &#x4E2A;&#x5B57;&#x8282;&#xFF0C;&#x5219;&#x53EA;&#x6709;&#x524D;&#x9762; <code>len</code> &#x4E2A;&#x5B57;&#x8282;&#x4F1A;&#x4FDD;&#x7559;&#x5728;&#x6587;&#x4EF6;&#x4E2D;&#x3002;</p>
  <p>&#x4F8B;&#x5982;&#xFF0C;&#x4EE5;&#x4E0B;&#x7A0B;&#x5E8F;&#x53EA;&#x4FDD;&#x7559;&#x6587;&#x4EF6;&#x7684;&#x524D; 4 &#x4E2A;&#x5B57;&#x8282;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  <span class="hljs-keyword">const</span> fsPromises = fs.promises;
  
  <span class="hljs-built_in">console</span>.log(fs.readFileSync(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>));
  <span class="hljs-comment">// &#x6253;&#x5370;: Node.js</span>
  
  <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">doTruncate</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">let</span> filehandle = <span class="hljs-literal">null</span>;
    <span class="hljs-keyword">try</span> {
      filehandle = <span class="hljs-keyword">await</span> fsPromises.open(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;r+&apos;</span>);
      <span class="hljs-keyword">await</span> filehandle.truncate(<span class="hljs-number">4</span>);
    } <span class="hljs-keyword">finally</span> {
      <span class="hljs-keyword">if</span> (filehandle) {
        <span class="hljs-comment">// &#x5982;&#x679C;&#x6587;&#x4EF6;&#x5DF2;&#x6253;&#x5F00;&#xFF0C;&#x5219;&#x5173;&#x95ED;&#x6587;&#x4EF6;&#x3002;</span>
        <span class="hljs-keyword">await</span> filehandle.close();
      }
    }
    <span class="hljs-built_in">console</span>.log(fs.readFileSync(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>));  <span class="hljs-comment">// &#x6253;&#x5370;: Node</span>
  }
  
  doTruncate().catch(<span class="hljs-built_in">console</span>.error);</code></pre>
  <p>&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5C0F;&#x4E8E; <code>len</code> &#x4E2A;&#x5B57;&#x8282;&#xFF0C;&#x5219;&#x4F1A;&#x5BF9;&#x5176;&#x8FDB;&#x884C;&#x6269;&#x5C55;&#xFF0C;&#x5E76;&#x4E14;&#x6269;&#x5C55;&#x90E8;&#x5206;&#x5C06;&#x586B;&#x5145;&#x7A7A;&#x5B57;&#x8282;&#xFF08;<code>&apos;\0&apos;</code>&#xFF09;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  <span class="hljs-keyword">const</span> fsPromises = fs.promises;
  
  <span class="hljs-built_in">console</span>.log(fs.readFileSync(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>));
  <span class="hljs-comment">// &#x6253;&#x5370;: Node.js</span>
  
  <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">doTruncate</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">let</span> filehandle = <span class="hljs-literal">null</span>;
    <span class="hljs-keyword">try</span> {
      filehandle = <span class="hljs-keyword">await</span> fsPromises.open(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;r+&apos;</span>);
      <span class="hljs-keyword">await</span> filehandle.truncate(<span class="hljs-number">10</span>);
    } <span class="hljs-keyword">finally</span> {
      <span class="hljs-keyword">if</span> (filehandle) {
        <span class="hljs-comment">// &#x5982;&#x679C;&#x6587;&#x4EF6;&#x5DF2;&#x6253;&#x5F00;&#xFF0C;&#x5219;&#x5173;&#x95ED;&#x6587;&#x4EF6;&#x3002;</span>
        <span class="hljs-keyword">await</span> filehandle.close();
      }
    }
    <span class="hljs-built_in">console</span>.log(fs.readFileSync(<span class="hljs-string">&apos;temp.txt&apos;</span>, <span class="hljs-string">&apos;utf8&apos;</span>));  <span class="hljs-comment">// &#x6253;&#x5370; Node.js\0\0\0</span>
  }
  
  doTruncate().catch(<span class="hljs-built_in">console</span>.error);</code></pre>
  <p>&#x6700;&#x540E; 3 &#x4E2A;&#x5B57;&#x8282;&#x662F;&#x7A7A;&#x5B57;&#x8282;&#xFF08;<code>&apos;\0&apos;</code>&#xFF09;&#xFF0C;&#x4EE5;&#x8865;&#x5145;&#x8D85;&#x51FA;&#x7684;&#x622A;&#x65AD;&#x3002;</p>
  <h4><code>filehandle.utimes(atime, mtime)</code><span><a class="mark" href="#fs_filehandle_utimes_atime_mtime" id="fs_filehandle_utimes_atime_mtime">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_utimes_atime_mtime.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_utimes_atime_mtime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>atime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li><code>mtime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x66F4;&#x6539; <code>FileHandle</code> &#x6307;&#x5411;&#x7684;&#x5BF9;&#x8C61;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x65F6;&#x95F4;&#x6233;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x6B64;&#x51FD;&#x6570;&#x5728; 7.1 &#x4E4B;&#x524D;&#x7684; AIX &#x7248;&#x672C;&#x4E0A;&#x4E0D;&#x8D77;&#x4F5C;&#x7528;&#xFF0C;&#x5B83;&#x5C06;&#x4F1A;&#x89E3;&#x51B3; <code>Promise</code> &#x5E76;&#x5E26;&#x4E0A;&#x4F7F;&#x7528; <code>UV_ENOSYS</code> &#x4EE3;&#x7801;&#x7684;&#x9519;&#x8BEF;&#x3002;</p>
  <h4><code>filehandle.write(buffer[, offset[, length[, position]]])</code><span><a class="mark" href="#fs_filehandle_write_buffer_offset_length_position" id="fs_filehandle_write_buffer_offset_length_position">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_write_buffer_offset_length_position.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_write_buffer_offset_length_position.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>The <code>buffer</code> parameter won&apos;t coerce unsupported input to buffers anymore.</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>buffer</code> <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/ZbDkpm" target="_blank" rel="nofollow" class="type">&lt;Uint8Array&gt;</a></li>
  <li><code>offset</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>length</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5199;&#x5165; <code>buffer</code> &#x5230;&#x6587;&#x4EF6;&#x3002;</p>
  <p><code>Promise</code> &#x4F1A;&#x88AB;&#x89E3;&#x51B3;&#x5E76;&#x5E26;&#x4E0A;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5BF9;&#x8C61;&#x5305;&#x542B;&#x4E00;&#x4E2A; <code>bytesWritten</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#xFF09;&#x548C;&#x4E00;&#x4E2A; <code>buffer</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5411;&#x5199;&#x5165;&#x7684; <code>buffer</code>&#xFF09;&#x3002;</p>
  <p><code>offset</code> &#x51B3;&#x5B9A; buffer &#x4E2D;&#x8981;&#x88AB;&#x5199;&#x5165;&#x7684;&#x90E8;&#x4F4D;&#xFF0C; <code>length</code> &#x662F;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x8981;&#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#x3002;</p>
  <p><code>position</code> &#x6307;&#x5B9A;&#x6587;&#x4EF6;&#x5F00;&#x5934;&#x7684;&#x504F;&#x79FB;&#x91CF;&#xFF08;&#x6570;&#x636E;&#x8981;&#x88AB;&#x5199;&#x5165;&#x7684;&#x4F4D;&#x7F6E;&#xFF09;&#x3002;
  &#x5982;&#x679C; <code>typeof position !== &apos;number&apos;</code>&#xFF0C;&#x5219;&#x6570;&#x636E;&#x4F1A;&#x88AB;&#x5199;&#x5165;&#x5F53;&#x524D;&#x7684;&#x4F4D;&#x7F6E;&#x3002;
  &#x53C2;&#x89C1; <a href="/s/2qJ9AM" rel="nofollow"><code>pwrite(2)</code></a>&#x3002;</p>
  <p>&#x5728;&#x540C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x4E0A;&#x591A;&#x6B21;&#x4F7F;&#x7528; <code>filehandle.write()</code> &#x4E14;&#x4E0D;&#x7B49;&#x5F85; <code>Promise</code> &#x88AB;&#x89E3;&#x51B3;&#xFF08;&#x6216;&#x88AB;&#x62D2;&#x7EDD;&#xFF09;&#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#x3002;
  &#x5BF9;&#x4E8E;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528; <a href="/s/VdSJQa" rel="nofollow"><code>fs.createWriteStream()</code></a>&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53;&#x4EE5;&#x8FFD;&#x52A0;&#x6A21;&#x5F0F;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x65F6;&#xFF0C;&#x5219;&#x5199;&#x5165;&#x65F6;&#x65E0;&#x6CD5;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x3002;
  &#x5185;&#x6838;&#x4F1A;&#x5FFD;&#x7565;&#x4F4D;&#x7F6E;&#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x59CB;&#x7EC8;&#x8FFD;&#x52A0;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#x7684;&#x672B;&#x5C3E;&#x3002;</p>
  <h4><code>filehandle.write(string[, position[, encoding]])</code><span><a class="mark" href="#fs_filehandle_write_string_position_encoding" id="fs_filehandle_write_string_position_encoding">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_write_string_position_encoding.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_write_string_position_encoding.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>The <code>string</code> parameter won&apos;t coerce unsupported input to strings anymore.</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>string</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5C06; <code>string</code> &#x5199;&#x5165;&#x5230;&#x6587;&#x4EF6;&#x3002;
  &#x5982;&#x679C; <code>string</code> &#x4E0D;&#x662F;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x4F1A;&#x629B;&#x51FA;&#x5F02;&#x5E38;&#x3002;</p>
  <p><code>Promise</code> &#x4F1A;&#x88AB;&#x89E3;&#x51B3;&#x5E76;&#x5E26;&#x4E0A;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5BF9;&#x8C61;&#x5305;&#x542B;&#x4E00;&#x4E2A; <code>bytesWritten</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#xFF09;&#x548C;&#x4E00;&#x4E2A; <code>buffer</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5411;&#x5199;&#x5165;&#x7684; <code>string</code>&#xFF09;&#x3002;</p>
  <p><code>position</code> &#x6307;&#x5B9A;&#x6587;&#x4EF6;&#x5F00;&#x5934;&#x7684;&#x504F;&#x79FB;&#x91CF;&#xFF08;&#x6570;&#x636E;&#x8981;&#x88AB;&#x5199;&#x5165;&#x7684;&#x4F4D;&#x7F6E;&#xFF09;&#x3002;
  &#x5982;&#x679C; <code>position</code> &#x7684;&#x7C7B;&#x578B;&#x4E0D;&#x662F;&#x4E00;&#x4E2A; <code>number</code>&#xFF0C;&#x5219;&#x6570;&#x636E;&#x4F1A;&#x88AB;&#x5199;&#x5165;&#x5F53;&#x524D;&#x7684;&#x4F4D;&#x7F6E;&#x3002;
  &#x53C2;&#x89C1; <a href="/s/2qJ9AM" rel="nofollow"><code>pwrite(2)</code></a>&#x3002;</p>
  <p><code>encoding</code> &#x662F;&#x671F;&#x671B;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x7F16;&#x7801;&#x3002;</p>
  <p>&#x5728;&#x540C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x4E0A;&#x591A;&#x6B21;&#x4F7F;&#x7528; <code>filehandle.write()</code> &#x4E14;&#x4E0D;&#x7B49;&#x5F85; <code>Promise</code> &#x88AB;&#x89E3;&#x51B3;&#xFF08;&#x6216;&#x88AB;&#x62D2;&#x7EDD;&#xFF09;&#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#x3002;
  &#x5BF9;&#x4E8E;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528; <a href="/s/VdSJQa" rel="nofollow"><code>fs.createWriteStream()</code></a>&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53;&#x4EE5;&#x8FFD;&#x52A0;&#x6A21;&#x5F0F;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x65F6;&#xFF0C;&#x5219;&#x5199;&#x5165;&#x65F6;&#x65E0;&#x6CD5;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x3002;
  &#x5185;&#x6838;&#x4F1A;&#x5FFD;&#x7565;&#x4F4D;&#x7F6E;&#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x59CB;&#x7EC8;&#x8FFD;&#x52A0;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#x7684;&#x672B;&#x5C3E;&#x3002;</p>
  <h4><code>filehandle.writeFile(data, options)</code><span><a class="mark" href="#fs_filehandle_writefile_data_options" id="fs_filehandle_writefile_data_options">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_writefile_data_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_writefile_data_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>data</code> &#x4E0D;&#x518D;&#x5F3A;&#x5236;&#x8F6C;&#x6362;&#x4E0D;&#x652F;&#x6301;&#x7684;&#x8F93;&#x5165;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>data</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/ZbDkpm" target="_blank" rel="nofollow" class="type">&lt;Uint8Array&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x5C06;&#x6570;&#x636E;&#x5199;&#x5165;&#x5230;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5DF2;&#x5B58;&#x5728;&#x5219;&#x8986;&#x76D6;&#x8BE5;&#x6587;&#x4EF6;&#x3002;
  <code>data</code> &#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x6216; buffer&#x3002;
  <code>Promise</code> &#x5C06;&#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>data</code> &#x662F; buffer&#xFF0C;&#x5219; <code>encoding</code> &#x9009;&#x9879;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <p><code>FileHandle</code> &#x5FC5;&#x987B;&#x652F;&#x6301;&#x5199;&#x5165;&#x3002;</p>
  <p>&#x5728;&#x540C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x4E0A;&#x591A;&#x6B21;&#x4F7F;&#x7528; <code>filehandle.writeFile()</code> &#x4E14;&#x4E0D;&#x7B49;&#x5F85; <code>Promise</code> &#x88AB;&#x89E3;&#x51B3;&#xFF08;&#x6216;&#x88AB;&#x62D2;&#x7EDD;&#xFF09;&#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x5BF9;&#x6587;&#x4EF6;&#x53E5;&#x67C4;&#x8FDB;&#x884C;&#x4E86;&#x4E00;&#x6B21;&#x6216;&#x591A;&#x6B21; <code>filehandle.write()</code> &#x8C03;&#x7528;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x8C03;&#x7528; <code>filehandle.writeFile()</code>&#xFF0C;&#x5219;&#x5C06;&#x4ECE;&#x5F53;&#x524D;&#x4F4D;&#x7F6E;&#x5199;&#x5165;&#x6570;&#x636E;&#xFF0C;&#x76F4;&#x5230;&#x6587;&#x4EF6;&#x7ED3;&#x675F;&#x3002;
  &#x5B83;&#x5E76;&#x4E0D;&#x603B;&#x662F;&#x4ECE;&#x6587;&#x4EF6;&#x7684;&#x5F00;&#x5934;&#x5199;&#x5165;&#x3002;</p>
  <h4><code>filehandle.writev(buffers[, position])</code><span><a class="mark" href="#fs_filehandle_writev_buffers_position" id="fs_filehandle_writev_buffers_position">#</a></span></h4><p class="tip_wrap"><a href="/api/fs/filehandle_writev_buffers_position.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/filehandle_writev_buffers_position.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v12.9.0</span>
  </div>
  <ul>
  <li><code>buffers</code> <a href="/s/qijt55" target="_blank" rel="nofollow" class="type">&lt;ArrayBufferView[]&gt;</a></li>
  <li><code>position</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5C06; <code>ArrayBufferViews</code> &#x6570;&#x7EC4;&#x5199;&#x5165;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</p>
  <p><code>Promise</code> &#x4F1A;&#x88AB;&#x89E3;&#x51B3;&#x5E76;&#x5E26;&#x4E0A;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5BF9;&#x8C61;&#x5305;&#x542B;&#x4E00;&#x4E2A; <code>bytesWritten</code> &#x5C5E;&#x6027;&#xFF08;&#x8868;&#x660E;&#x5199;&#x5165;&#x7684;&#x5B57;&#x8282;&#x6570;&#xFF09;&#x548C;&#x4E00;&#x4E2A; <code>buffers</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5411; <code>buffers</code> &#x8F93;&#x5165;&#xFF09;&#x3002;</p>
  <p><code>position</code> &#x6307;&#x5B9A;&#x6587;&#x4EF6;&#x5F00;&#x5934;&#x7684;&#x504F;&#x79FB;&#x91CF;&#xFF08;&#x6570;&#x636E;&#x8981;&#x88AB;&#x5199;&#x5165;&#x7684;&#x4F4D;&#x7F6E;&#xFF09;&#x3002;
  &#x5982;&#x679C; <code>typeof position !== &apos;number&apos;</code>&#xFF0C;&#x5219;&#x6570;&#x636E;&#x4F1A;&#x88AB;&#x5199;&#x5165;&#x5F53;&#x524D;&#x7684;&#x4F4D;&#x7F6E;&#x3002; </p>
  <p>&#x5728;&#x540C;&#x4E00;&#x6587;&#x4EF6;&#x4E0A;&#x591A;&#x6B21;&#x8C03;&#x7528; <code>writev()</code> &#x4E14;&#x4E0D;&#x7B49;&#x5F85;&#x524D;&#x9762;&#x7684;&#x64CD;&#x4F5C;&#x5B8C;&#x6210;&#xFF0C;&#x8FD9;&#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53;&#x4EE5;&#x8FFD;&#x52A0;&#x6A21;&#x5F0F;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x65F6;&#xFF0C;&#x5219;&#x5199;&#x5165;&#x65F6;&#x65E0;&#x6CD5;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x3002;
  &#x5185;&#x6838;&#x4F1A;&#x5FFD;&#x7565;&#x4F4D;&#x7F6E;&#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x59CB;&#x7EC8;&#x8FFD;&#x52A0;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#x7684;&#x672B;&#x5C3E;&#x3002;</p>
  <h3><code>fsPromises.access(path[, mode])</code><span><a class="mark" href="#fs_fspromises_access_path_mode" id="fs_fspromises_access_path_mode">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_access_path_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_access_path_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>fs.constants.F_OK</code>&#x3002;</li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x6D4B;&#x8BD5;&#x7528;&#x6237;&#x5BF9; <code>path</code> &#x6307;&#x5B9A;&#x7684;&#x6587;&#x4EF6;&#x6216;&#x76EE;&#x5F55;&#x7684;&#x6743;&#x9650;&#x3002;
  <code>mode</code> &#x53C2;&#x6570;&#x662F;&#x4E00;&#x4E2A;&#x53EF;&#x9009;&#x7684;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x8981;&#x6267;&#x884C;&#x7684;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x68C0;&#x67E5;&#x3002;
  &#x67E5;&#x770B;<a href="/s/qZfpqk" rel="nofollow">&#x6587;&#x4EF6;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x7684;&#x5E38;&#x91CF;</a>&#x4E86;&#x89E3; <code>mode</code> &#x7684;&#x53EF;&#x9009;&#x503C;&#x3002;<br>
  &#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x7531;&#x4E24;&#x4E2A;&#x6216;&#x66F4;&#x591A;&#x4E2A;&#x503C;&#x6309;&#x4F4D;&#x6216;&#x7EC4;&#x6210;&#x7684;&#x63A9;&#x7801;&#xFF08;&#x4F8B;&#x5982; <code>fs.constants.W_OK | fs.constants.R_OK</code>&#xFF09;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x68C0;&#x67E5;&#x6210;&#x529F;&#xFF0C;&#x5219; <code>Promise</code> &#x4F1A;&#x88AB;&#x89E3;&#x51B3;&#x4E14;&#x4E0D;&#x5E26;&#x503C;&#x3002;
  &#x5982;&#x679C;&#x4EFB;&#x4F55;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x68C0;&#x67E5;&#x5931;&#x8D25;&#xFF0C;&#x5219; <code>Promise</code> &#x4F1A;&#x88AB;&#x62D2;&#x7EDD;&#x5E76;&#x5E26;&#x4E0A; <code>Error</code> &#x5BF9;&#x8C61;&#x3002;
  &#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#x4F1A;&#x68C0;&#x67E5;&#x5F53;&#x524D;&#x8FDB;&#x7A0B;&#x662F;&#x5426;&#x53EF;&#x4EE5;&#x8BFB;&#x53D6;&#x548C;&#x5199;&#x5165; <code>/etc/passwd</code> &#x6587;&#x4EF6;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  <span class="hljs-keyword">const</span> fsPromises = fs.promises;
  
  fsPromises.access(<span class="hljs-string">&apos;/etc/passwd&apos;</span>, fs.constants.R_OK | fs.constants.W_OK)
    .then(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x53EF;&#x4EE5;&#x8BBF;&#x95EE;&apos;</span>))
    .catch(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> <span class="hljs-built_in">console</span>.error(<span class="hljs-string">&apos;&#x4E0D;&#x53EF;&#x8BBF;&#x95EE;&apos;</span>));</code></pre>
  <p>&#x4E0D;&#x5EFA;&#x8BAE;&#x5728;&#x8C03;&#x7528; <code>fsPromises.open()</code> &#x4E4B;&#x524D;&#x4F7F;&#x7528; <code>fsPromises.access()</code> &#x68C0;&#x67E5;&#x6587;&#x4EF6;&#x7684;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x3002;
  &#x8FD9;&#x6837;&#x505A;&#x4F1A;&#x5F15;&#x5165;&#x7ADE;&#x6001;&#x6761;&#x4EF6;&#xFF0C;&#x56E0;&#x4E3A;&#x5176;&#x4ED6;&#x8FDB;&#x7A0B;&#x53EF;&#x80FD;&#x4F1A;&#x5728;&#x4E24;&#x4E2A;&#x8C03;&#x7528;&#x4E4B;&#x95F4;&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x72B6;&#x6001;&#x3002;
  &#x800C;&#x662F;&#xFF0C;&#x5E94;&#x8BE5;&#x76F4;&#x63A5;&#x6253;&#x5F00;&#x3001;&#x8BFB;&#x53D6;&#x6216;&#x5199;&#x5165;&#x6587;&#x4EF6;&#xFF0C;&#x5E76;&#x4E14;&#x5F53;&#x6587;&#x4EF6;&#x65E0;&#x6CD5;&#x8BBF;&#x95EE;&#x65F6;&#x5904;&#x7406;&#x5F15;&#x53D1;&#x7684;&#x9519;&#x8BEF;&#x3002;</p>
  <h3><code>fsPromises.appendFile(path, data[, options])</code><span><a class="mark" href="#fs_fspromises_appendfile_path_data_options" id="fs_fspromises_appendfile_path_data_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_appendfile_path_data_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_appendfile_path_data_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> | <a href="/s/kLdifB" target="_blank" rel="nofollow" class="type">&lt;FileHandle&gt;</a> &#x6587;&#x4EF6;&#x540D;&#x6216; <code>FileHandle</code>&#x3002;</li>
  <li><code>data</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#x3002;</li>
  <li><code>flag</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;&#x9ED8;&#x8BA4;&#x503C;: <code>&apos;a&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x8FFD;&#x52A0;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5C1A;&#x4E0D;&#x5B58;&#x5728;&#x5219;&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#x3002;
  <code>data</code> &#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x6216; <a href="/s/FApxjh" rel="nofollow"><code>Buffer</code></a>&#x3002;
  <code>Promise</code> &#x5C06;&#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <p><code>path</code> &#x53EF;&#x4EE5;&#x6307;&#x5B9A;&#x4E3A;&#x5DF2;&#x6253;&#x5F00;&#x7528;&#x4E8E;&#x8FFD;&#x52A0;&#xFF08;&#x4F7F;&#x7528; <code>fsPromises.open()</code>&#xFF09;&#x7684; <code>FileHandle</code>&#x3002;</p>
  <h3><code>fsPromises.chmod(path, mode)</code><span><a class="mark" href="#fs_fspromises_chmod_path_mode" id="fs_fspromises_chmod_path_mode">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_chmod_path_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_chmod_path_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x6743;&#x9650;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <h3><code>fsPromises.chown(path, uid, gid)</code><span><a class="mark" href="#fs_fspromises_chown_path_uid_gid" id="fs_fspromises_chown_path_uid_gid">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_chown_path_uid_gid.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_chown_path_uid_gid.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>uid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>gid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x66F4;&#x6539;&#x6587;&#x4EF6;&#x7684;&#x6240;&#x6709;&#x8005;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002; </p>
  <h3><code>fsPromises.copyFile(src, dest[, mode])</code><span><a class="mark" href="#fs_fspromises_copyfile_src_dest_mode" id="fs_fspromises_copyfile_src_dest_mode">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_copyfile_src_dest_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_copyfile_src_dest_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>src</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> &#x8981;&#x62F7;&#x8D1D;&#x7684;&#x6E90;&#x6587;&#x4EF6;&#x540D;&#x3002;</li>
  <li><code>dest</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> &#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x540D;&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x7528;&#x4E8E;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x4FEE;&#x9970;&#x7B26;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x5C06; <code>src</code> &#x62F7;&#x8D1D;&#x5230; <code>dest</code>&#x3002;
  &#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5982;&#x679C; <code>dest</code> &#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x8986;&#x76D6;&#x5B83;&#x3002;
  <code>Promise</code> &#x5C06;&#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <p>Node.js &#x4E0D;&#x4FDD;&#x8BC1;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x539F;&#x5B50;&#x6027;&#x3002;
  &#x5982;&#x679C;&#x5728;&#x6253;&#x5F00;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x5199;&#x5165;&#x540E;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#xFF0C;&#x5219; Node.js &#x5C06;&#x5C1D;&#x8BD5;&#x5220;&#x9664;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x3002;</p>
  <p><code>mode</code> &#x662F;&#x4E00;&#x4E2A;&#x53EF;&#x9009;&#x7684;&#x6574;&#x6570;&#xFF0C;&#x6307;&#x5B9A;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x7684;&#x884C;&#x4E3A;&#x3002;
  &#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x7531;&#x4E24;&#x4E2A;&#x6216;&#x66F4;&#x591A;&#x4E2A;&#x503C;&#x6309;&#x4F4D;&#x6216;&#x7EC4;&#x6210;&#x7684;&#x63A9;&#x7801;&#xFF08;&#x6BD4;&#x5982; <code>fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE</code>&#xFF09;&#x3002;</p>
  <ul>
  <li><code>fs.constants.COPYFILE_EXCL</code> - &#x5982;&#x679C; <code>dest</code> &#x5DF2;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</li>
  <li><code>fs.constants.COPYFILE_FICLONE</code> - &#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5C1D;&#x8BD5;&#x521B;&#x5EFA;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF08;copy-on-write&#xFF09;&#x94FE;&#x63A5;&#x3002;&#x5982;&#x679C;&#x5E73;&#x53F0;&#x4E0D;&#x652F;&#x6301;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF0C;&#x5219;&#x4F7F;&#x7528;&#x540E;&#x5907;&#x7684;&#x62F7;&#x8D1D;&#x673A;&#x5236;&#x3002;</li>
  <li><code>fs.constants.COPYFILE_FICLONE_FORCE</code> - &#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5C1D;&#x8BD5;&#x521B;&#x5EFA;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#x94FE;&#x63A5;&#x3002;&#x5982;&#x679C;&#x5E73;&#x53F0;&#x4E0D;&#x652F;&#x6301;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF0C;&#x5219;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</li>
  </ul>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> {
    <span class="hljs-attr">promises</span>: fsPromises,
    <span class="hljs-attr">constants</span>: {
      COPYFILE_EXCL
    }
  } = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  
  <span class="hljs-comment">// &#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x5C06;&#x521B;&#x5EFA;&#x6216;&#x8986;&#x76D6;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x3002;</span>
  fsPromises.copyFile(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x76EE;&#x6807;&#x6587;&#x4EF6;.txt&apos;</span>)
    .then(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;&#x5DF2;&#x62F7;&#x8D1D;&#x5230;&#x76EE;&#x6807;&#x6587;&#x4EF6;&apos;</span>))
    .catch(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8BE5;&#x6587;&#x4EF6;&#x65E0;&#x6CD5;&#x62F7;&#x8D1D;&apos;</span>));
  
  <span class="hljs-comment">// &#x901A;&#x8FC7;&#x4F7F;&#x7528; COPYFILE_EXCL&#xFF0C;&#x5982;&#x679C;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</span>
  fsPromises.copyFile(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;.txt&apos;</span>, <span class="hljs-string">&apos;&#x76EE;&#x6807;&#x6587;&#x4EF6;.txt&apos;</span>, COPYFILE_EXCL)
    .then(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x6E90;&#x6587;&#x4EF6;&#x5DF2;&#x62F7;&#x8D1D;&#x5230;&#x76EE;&#x6807;&#x6587;&#x4EF6;&apos;</span>))
    .catch(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;&#x8BE5;&#x6587;&#x4EF6;&#x65E0;&#x6CD5;&#x62F7;&#x8D1D;&apos;</span>));</code></pre>
  <h3><code>fsPromises.lchmod(path, mode)</code><span><a class="mark" href="#fs_fspromises_lchmod_path_mode" id="fs_fspromises_lchmod_path_mode">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_lchmod_path_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_lchmod_path_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x5F03;&#x7528;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x66F4;&#x6539;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#x7684;&#x6743;&#x9650;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;
  &#x6B64;&#x65B9;&#x6CD5;&#x4EC5;&#x5728; macOS &#x4E0A;&#x5B9E;&#x73B0;&#x3002;</p>
  <h3><code>fsPromises.lchown(path, uid, gid)</code><span><a class="mark" href="#fs_fspromises_lchown_path_uid_gid" id="fs_fspromises_lchown_path_uid_gid">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_lchown_path_uid_gid.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_lchown_path_uid_gid.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.6.0</td>
  <td><p>This API is no longer deprecated.</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>uid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li><code>gid</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x66F4;&#x6539;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#x7684;&#x62E5;&#x6709;&#x8005;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <h3><code>fsPromises.lutimes(path, atime, mtime)</code><span><a class="mark" href="#fs_fspromises_lutimes_path_atime_mtime" id="fs_fspromises_lutimes_path_atime_mtime">#</a></span></h3><p class="tip_wrap"><span class="tip_no_trans">&#x6682;&#x65E0;&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</span><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_lutimes_path_atime_mtime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v14.5.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>atime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li><code>mtime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li>Returns: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>Changes the access and modification times of a file in the same way as
  <a href="/s/H6swTV" rel="nofollow"><code>fsPromises.utimes()</code></a>, with the difference that if the path refers to a
  symbolic link, then the link is not dereferenced: instead, the timestamps of
  the symbolic link itself are changed.</p>
  <p>Upon success, the <code>Promise</code> is resolved without arguments.</p>
  <h3><code>fsPromises.link(existingPath, newPath)</code><span><a class="mark" href="#fs_fspromises_link_existingpath_newpath" id="fs_fspromises_link_existingpath_newpath">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_link_existingpath_newpath.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_link_existingpath_newpath.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>existingPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>newPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/U8H1mr" rel="nofollow"><code>link(2)</code></a>&#x3002;
  <code>Promise</code> &#x5C06;&#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <h3><code>fsPromises.lstat(path[, options])</code><span><a class="mark" href="#fs_fspromises_lstat_path_options" id="fs_fspromises_lstat_path_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_lstat_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_lstat_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>&#x63A5;&#x53D7;&#x989D;&#x5916;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; bigint&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x8FD4;&#x56DE;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x5E94;&#x4E3A; <code>bigint</code> &#x578B;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/fGaHTu" rel="nofollow"><code>lstat(2)</code></a>&#x3002;
  <code>Promise</code> &#x4F1A;&#x88AB;&#x89E3;&#x51B3;&#x5E76;&#x5E26;&#x4E0A;&#x7528;&#x4E8E;&#x7ED9;&#x5B9A;&#x7684;&#x7B26;&#x53F7;&#x94FE;&#x63A5; <code>path</code> &#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x3002;</p>
  <h3><code>fsPromises.mkdir(path[, options])</code><span><a class="mark" href="#fs_fspromises_mkdir_path_options" id="fs_fspromises_mkdir_path_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_mkdir_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_mkdir_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a></p>
  <ul>
  <li><code>recursive</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x5728; Windows &#x4E0A;&#x4E0D;&#x652F;&#x6301;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o777</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x521B;&#x5EFA;&#x76EE;&#x5F55;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code>&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#xFF0C;&#x6216;&#x8005;&#x5E26;&#x4E0A;&#x521B;&#x5EFA;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x76EE;&#x5F55;&#x7684;&#x8DEF;&#x5F84;&#xFF08;&#x5982;&#x679C; <code>recursive</code> &#x4E3A; <code>true</code>&#xFF09;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x#x4EE5;&#x662F;&#x6574;&#x6570;&#xFF08;&#x6307;&#x5B9A; <code>mode</code>&#xFF08;&#x6743;&#x9650;&#x548C;&#x7C98;&#x6EDE;&#x4F4D;&#xFF09;&#xFF09;&#x3001;&#x6216;&#x5BF9;&#x8C61;&#xFF08;&#x5177;&#x6709; <code>mode</code> &#x5C5E;&#x6027;&#x548C; <code>recursive</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x793A;&#x662F;&#x5426;&#x8981;&#x521B;&#x5EFA;&#x7236;&#x76EE;&#x5F55;&#xFF09;&#xFF09;&#x3002;
  &#x5F53; <code>path</code> &#x662F;&#x5DF2;&#x5B58;&#x5728;&#x7684;&#x76EE;&#x5F55;&#x65F6;&#xFF0C;&#x8C03;&#x7528; <code>fsPromises.mkdir()</code> &#x4EC5;&#x5728; <code>recursive</code> &#x4E3A; false &#x65F6;&#x624D;&#x5BFC;&#x81F4;&#x62D2;&#x7EDD;&#x3002;</p>
  <h3><code>fsPromises.mkdtemp(prefix[, options])</code><span><a class="mark" href="#fs_fspromises_mkdtemp_prefix_options" id="fs_fspromises_mkdtemp_prefix_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_mkdtemp_prefix_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_mkdtemp_prefix_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>prefix</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x552F;&#x4E00;&#x7684;&#x4E34;&#x65F6;&#x76EE;&#x5F55;&#xFF0C;&#x4E14;&#x89E3;&#x51B3; <code>Promise</code> &#x65F6;&#x5E26;&#x4E0A;&#x521B;&#x5EFA;&#x7684;&#x76EE;&#x5F55;&#x8DEF;&#x5F84;&#x3002;
  &#x552F;&#x4E00;&#x7684;&#x76EE;&#x5F55;&#x540D;&#x79F0;&#x662F;&#x901A;&#x8FC7;&#x5728;&#x63D0;&#x4F9B;&#x7684; <code>prefix</code> &#x7684;&#x672B;&#x5C3E;&#x9644;&#x52A0;&#x516D;&#x4E2A;&#x968F;&#x673A;&#x5B57;&#x7B26;&#x6765;&#x751F;&#x6210;&#x7684;&#x3002;
  &#x7531;&#x4E8E;&#x5E73;&#x53F0;&#x7684;&#x4E0D;&#x4E00;&#x81F4;&#x6027;&#xFF0C;&#x8BF7;&#x907F;&#x514D;&#x5728; <code>prefix</code> &#x4E2D;&#x4EE5; <code>X</code> &#x5B57;&#x7B26;&#x7ED3;&#x5C3E;&#x3002;
  &#x5728;&#x67D0;&#x4E9B;&#x5E73;&#x53F0;&#x4E0A;&#xFF0C;&#x7279;&#x522B;&#x662F; BSD&#xFF0C;&#x53EF;&#x4EE5;&#x8FD4;&#x56DE;&#x516D;&#x4E2A;&#x4EE5;&#x4E0A;&#x7684;&#x968F;&#x673A;&#x5B57;&#x7B26;&#xFF0C;&#x5E76;&#x7528;&#x968F;&#x673A;&#x5B57;&#x7B26;&#x66FF;&#x6362; <code>prefix</code> &#x4E2D;&#x7ED3;&#x5C3E;&#x7684; <code>X</code> &#x5B57;&#x7B26;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x5177;&#x6709;&#x6307;&#x5B9A;&#x8981;&#x4F7F;&#x7528;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x7684; <code>encoding</code> &#x5C5E;&#x6027;&#x7684;&#x5BF9;&#x8C61;&#x3002;</p>
  <pre><code class="language-js">fsPromises.mkdtemp(path.join(os.tmpdir(), <span class="hljs-string">&apos;foo-&apos;</span>))
    .catch(<span class="hljs-built_in">console</span>.error);</code></pre>
  <p><code>fsPromises.mkdtemp()</code> &#x65B9;&#x6CD5;&#x5C06;&#x516D;&#x4F4D;&#x968F;&#x673A;&#x9009;&#x62E9;&#x7684;&#x5B57;&#x7B26;&#x76F4;&#x63A5;&#x9644;&#x52A0;&#x5230; <code>prefix</code> &#x5B57;&#x7B26;&#x4E32;&#x3002;
  &#x4F8B;&#x5982;&#xFF0C;&#x7ED9;&#x5B9A;&#x76EE;&#x5F55; <code>/tmp</code>&#xFF0C;&#x5982;&#x679C;&#x6253;&#x7B97;&#x5728; <code>/tmp</code> &#x4E2D;&#x521B;&#x5EFA;&#x4E34;&#x65F6;&#x76EE;&#x5F55;&#xFF0C;&#x5219; <code>prefix</code> &#x5FC5;&#x987B;&#x5728;&#x5C3E;&#x90E8;&#x52A0;&#x4E0A;&#x7279;&#x5B9A;&#x5E73;&#x53F0;&#x7684;&#x8DEF;&#x5F84;&#x5206;&#x9694;&#x7B26;&#xFF08;<code>require(&apos;path&apos;).sep</code>&#xFF09;&#x3002;</p>
  <h3><code>fsPromises.open(path, flags[, mode])</code><span><a class="mark" href="#fs_fspromises_open_path_flags_mode" id="fs_fspromises_open_path_flags_mode">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_open_path_flags_mode.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_open_path_flags_mode.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v11.1.0</td>
  <td><p>&#x53C2;&#x6570; <code>flags</code> &#x662F;&#x53EF;&#x9009;&#x7684;&#xFF0C;&#x5E76;&#x4E14;&#x9ED8;&#x8BA4;&#x4E3A; <code>&apos;r&apos;</code>&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>flags</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;r&apos;</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#xFF08;&#x53EF;&#x8BFB;&#x5199;&#xFF09;&#x3002;</li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x5E76;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A; <code>Promise</code>&#xFF0C;&#x5F53;&#x89E3;&#x51B3;&#x65F6;&#x4F1A;&#x5E26;&#x4E0A;&#x4E00;&#x4E2A; <code>FileHandle</code> &#x5BF9;&#x8C61;&#x3002;
  &#x53C2;&#x89C1; <a href="/s/ss2dGs" rel="nofollow"><code>open(2)</code></a>&#x3002;</p>
  <p><code>mode</code> &#x7528;&#x4E8E;&#x8BBE;&#x7F6E;&#x6587;&#x4EF6;&#x6A21;&#x5F0F;&#xFF08;&#x6743;&#x9650;&#x548C;&#x7C98;&#x6EDE;&#x4F4D;&#xFF09;&#xFF0C;&#x4F46;&#x4EC5;&#x9650;&#x4E8E;&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#x65F6;&#x3002;</p>
  <p>&#x6709;&#x4E9B;&#x5B57;&#x7B26; (<code>&lt; &gt; : &quot; / \ | ? *</code>) &#x5728; Windows &#x4E0A;&#x662F;&#x9884;&#x7559;&#x7684;&#xFF0C;&#x53C2;&#x89C1;<a href="/s/GmL95W" rel="nofollow">&#x547D;&#x540D;&#x6587;&#x4EF6;&#x3001;&#x8DEF;&#x5F84;&#x4EE5;&#x53CA;&#x547D;&#x540D;&#x7A7A;&#x95F4;</a>&#x3002;
  &#x5728; NTFS &#x4E0A;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x540D;&#x5305;&#x542B;&#x5192;&#x53F7;&#xFF0C;&#x5219; Node.js &#x4F1A;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x6D41;&#xFF0C;&#x53C2;&#x89C1;<a href="/s/FY8iKV" rel="nofollow">&#x6B64; MSDN &#x9875;&#x9762;</a>&#x3002;</p>
  <h3><code>fsPromises.opendir(path[, options])</code><span><a class="mark" href="#fs_fspromises_opendir_path_options" id="fs_fspromises_opendir_path_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_opendir_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_opendir_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.1.0, v12.16.0</td>
  <td><p>The <code>bufferSize</code> option was introduced.</p></td></tr>
  <tr><td>v12.12.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v12.12.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>bufferSize</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> &#x5F53;&#x4ECE;&#x76EE;&#x5F55;&#x8BFB;&#x53D6;&#x65F6;&#x5728;&#x5185;&#x90E8;&#x7F13;&#x51B2;&#x7684;&#x76EE;&#x5F55;&#x9879;&#x7684;&#x6570;&#x91CF;&#x3002;&#x503C;&#x8D8A;&#x9AD8;&#xFF0C;&#x5219;&#x6027;&#x80FD;&#x8D8A;&#x597D;&#xFF0C;&#x4F46;&#x5185;&#x5B58;&#x5360;&#x7528;&#x66F4;&#x9AD8;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>32</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: &#x5305;&#x542B; <a href="/s/PrNiRv" target="_blank" rel="nofollow" class="type">&lt;fs.Dir&gt;</a> &#x7684; <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x6253;&#x5F00;&#x76EE;&#x5F55;&#x3002; 
  &#x53C2;&#x89C1; <a href="/s/KKZ5fX" rel="nofollow"><code>opendir(3)</code></a>&#x3002;</p>
  <p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A; <a href="/s/PrNiRv" rel="nofollow"><code>fs.Dir</code></a>&#xFF0C;&#x5176;&#x4E2D;&#x5305;&#x542B;&#x6240;&#x6709;&#x7528;&#x4E8E;&#x66F4;&#x8FDB;&#x4E00;&#x6B65;&#x8BFB;&#x53D6;&#x548C;&#x6E05;&#x7406;&#x76EE;&#x5F55;&#x7684;&#x51FD;&#x6570;&#x3002;</p>
  <p><code>encoding</code> &#x9009;&#x9879;&#x7528;&#x4E8E;&#x5728;&#x6253;&#x5F00;&#x76EE;&#x5F55;&#x548C;&#x540E;&#x7EED;&#x7684;&#x8BFB;&#x53D6;&#x64CD;&#x4F5C;&#x65F6;&#x8BBE;&#x7F6E; <code>path</code> &#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <p>&#x4F7F;&#x7528;&#x5F02;&#x6B65;&#x8FED;&#x4EE3;&#x7684;&#x793A;&#x4F8B;&#xFF1A;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  
  <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">print</span>(<span class="hljs-params">path</span>) </span>{
    <span class="hljs-keyword">const</span> dir = <span class="hljs-keyword">await</span> fs.promises.opendir(path);
    <span class="hljs-keyword">for</span> <span class="hljs-keyword">await</span> (<span class="hljs-keyword">const</span> dirent <span class="hljs-keyword">of</span> dir) {
      <span class="hljs-built_in">console</span>.log(dirent.name);
    }
  }
  print(<span class="hljs-string">&apos;./&apos;</span>).catch(<span class="hljs-built_in">console</span>.error);</code></pre>
  <h3><code>fsPromises.readdir(path[, options])</code><span><a class="mark" href="#fs_fspromises_readdir_path_options" id="fs_fspromises_readdir_path_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_readdir_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_readdir_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.11.0</td>
  <td><p>&#x6DFB;&#x52A0;&#x65B0;&#x7684;&#x9009;&#x9879; <code>withFileTypes</code>&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>withFileTypes</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x8BFB;&#x53D6;&#x76EE;&#x5F55;&#x7684;&#x5185;&#x5BB9;&#xFF0C;&#x7136;&#x540E;&#x89E3;&#x51B3; <code>Promise</code> &#x5E76;&#x5E26;&#x4E0A;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;&#xFF08;&#x5305;&#x542B;&#x76EE;&#x5F55;&#x4E2D;&#x7684;&#x6587;&#x4EF6;&#x7684;&#x540D;&#x79F0;&#xFF0C;&#x4F46;&#x4E0D;&#x5305;&#x62EC; <code>&apos;.&apos;</code> &#x548C; <code>&apos;..&apos;</code>&#xFF09;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x6587;&#x4EF6;&#x540D;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options.withFileTypes</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x89E3;&#x51B3;&#x7684;&#x6570;&#x7EC4;&#x4F1A;&#x5305;&#x542B; <a href="/s/mNLVJ7" rel="nofollow"><code>fs.Dirent</code></a> &#x5BF9;&#x8C61;&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  
  <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">print</span>(<span class="hljs-params">path</span>) </span>{
    <span class="hljs-keyword">const</span> files = <span class="hljs-keyword">await</span> fs.promises.readdir(path);
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> file <span class="hljs-keyword">of</span> files) {
      <span class="hljs-built_in">console</span>.log(file);
    }
  }
  print(<span class="hljs-string">&apos;./&apos;</span>).catch(<span class="hljs-built_in">console</span>.error);</code></pre>
  <h3><code>fsPromises.readFile(path[, options])</code><span><a class="mark" href="#fs_fspromises_readfile_path_options" id="fs_fspromises_readfile_path_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_readfile_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_readfile_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> | <a href="/s/kLdifB" target="_blank" rel="nofollow" class="type">&lt;FileHandle&gt;</a> &#x6587;&#x4EF6;&#x540D;&#x6216; <code>FileHandle</code>&#x3002;</li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>null</code>&#x3002;</li>
  <li><code>flag</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;r&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x8BFB;&#x53D6;&#x6587;&#x4EF6;&#x7684;&#x5168;&#x90E8;&#x5185;&#x5BB9;&#x3002;</p>
  <p><code>Promise</code> &#x88AB;&#x89E3;&#x51B3;&#x65F6;&#x4F1A;&#x5E26;&#x4E0A;&#x6587;&#x4EF6;&#x7684;&#x5185;&#x5BB9;&#x3002;
  &#x5982;&#x679C;&#x6CA1;&#x6709;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF08;&#x4F7F;&#x7528; <code>options.encoding</code>&#xFF09;&#xFF0C;&#x5219;&#x6570;&#x636E;&#x4F1A;&#x4EE5; <code>Buffer</code> &#x5BF9;&#x8C61;&#x8FD4;&#x56DE;&#x3002;
  &#x5426;&#x5219;&#xFF0C;&#x6570;&#x636E;&#x5C06;&#x4F1A;&#x662F;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <p>&#x5F53; <code>path</code> &#x662F;&#x76EE;&#x5F55;&#x65F6;&#xFF0C; <code>fsPromises.readFile()</code> &#x7684;&#x884C;&#x4E3A;&#x662F;&#x7279;&#x5B9A;&#x4E8E;&#x5E73;&#x53F0;&#x7684;&#x3002;
  &#x5728; macOS&#x3001;Linux &#x548C; Windows &#x4E0A;&#xFF0C;promise &#x5C06;&#x4F1A;&#x88AB;&#x62D2;&#x7EDD;&#x5E76;&#x5E26;&#x4E0A;&#x4E00;&#x4E2A;&#x9519;&#x8BEF;&#x3002;
  &#x5728; FreeBSD &#x4E0A;&#xFF0C;&#x5219;&#x5C06;&#x4F1A;&#x8FD4;&#x56DE;&#x76EE;&#x5F55;&#x5185;&#x5BB9;&#x7684;&#x8868;&#x793A;&#x3002;</p>
  <p>&#x6307;&#x5B9A;&#x7684; <code>FileHandle</code> &#x5FC5;&#x987B;&#x652F;&#x6301;&#x8BFB;&#x53D6;&#x3002;</p>
  <h3><code>fsPromises.readlink(path[, options])</code><span><a class="mark" href="#fs_fspromises_readlink_path_options" id="fs_fspromises_readlink_path_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_readlink_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_readlink_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/CFw99K" rel="nofollow"><code>readlink(2)</code></a>&#x3002;
  <code>Promise</code> &#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x5E26;&#x4E0A; <code>linkString</code>&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x94FE;&#x63A5;&#x8DEF;&#x5F84;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x94FE;&#x63A5;&#x8DEF;&#x5F84;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <h3><code>fsPromises.realpath(path[, options])</code><span><a class="mark" href="#fs_fspromises_realpath_path_options" id="fs_fspromises_realpath_path_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_realpath_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_realpath_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x4F7F;&#x7528;&#x4E0E; <code>fs.realpath.native()</code> &#x51FD;&#x6570;&#x76F8;&#x540C;&#x7684;&#x8BED;&#x4E49;&#x6765;&#x5224;&#x65AD; <code>path</code> &#x7684;&#x5B9E;&#x9645;&#x4F4D;&#x7F6E;&#xFF0C;&#x7136;&#x540E;&#x89E3;&#x51B3; <code>Promise</code> &#x5E76;&#x5E26;&#x4E0A;&#x89E3;&#x6790;&#x540E;&#x7684;&#x8DEF;&#x5F84;&#x3002;</p>
  <p>&#x4EC5;&#x652F;&#x6301;&#x53EF;&#x8F6C;&#x6362;&#x4E3A; UTF8 &#x5B57;&#x7B26;&#x4E32;&#x7684;&#x8DEF;&#x5F84;&#x3002;</p>
  <p>&#x53EF;&#x9009;&#x7684; <code>options</code> &#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x3001;&#x6216;&#x5177;&#x6709; <code>encoding</code> &#x5C5E;&#x6027;&#xFF08;&#x6307;&#x5B9A;&#x7528;&#x4E8E;&#x8DEF;&#x5F84;&#x7684;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#xFF09;&#x7684;&#x5BF9;&#x8C61;&#x3002;
  &#x5982;&#x679C; <code>encoding</code> &#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;buffer&apos;</code>&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x7684;&#x8DEF;&#x5F84;&#x4F1A;&#x4F5C;&#x4E3A; <code>Buffer</code> &#x5BF9;&#x8C61;&#x4F20;&#x5165;&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53; Node.js &#x4E0E; musl libc &#x94FE;&#x63A5;&#x65F6;&#xFF0C;procfs &#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x5FC5;&#x987B;&#x6302;&#x8F7D;&#x5728; <code>/proc</code> &#x4E0A;&#x624D;&#x80FD;&#x4F7F;&#x6B64;&#x529F;&#x80FD;&#x6B63;&#x5E38;&#x5DE5;&#x4F5C;&#x3002;
  Glibc &#x6CA1;&#x6709;&#x8FD9;&#x4E2A;&#x9650;&#x5236;&#x3002;</p>
  <h3><code>fsPromises.rename(oldPath, newPath)</code><span><a class="mark" href="#fs_fspromises_rename_oldpath_newpath" id="fs_fspromises_rename_oldpath_newpath">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_rename_oldpath_newpath.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_rename_oldpath_newpath.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>oldPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>newPath</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5C06; <code>oldPath</code> &#x91CD;&#x547D;&#x540D;&#x4E3A; <code>newPath</code>&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <h3><code>fsPromises.rmdir(path[, options])</code><span><a class="mark" href="#fs_fspromises_rmdir_path_options" id="fs_fspromises_rmdir_path_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_rmdir_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_rmdir_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v13.3.0, v12.16.0</td>
  <td><p>&#x9009;&#x9879; <code>maxBusyTries</code> &#x88AB;&#x91CD;&#x547D;&#x540D;&#x4E3A; <code>maxRetries</code>&#xFF0C;&#x5E76;&#x4E14;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A; 0&#x3002; <code>emfileWait</code> &#x9009;&#x9879;&#x5DF2;&#x88AB;&#x5220;&#x9664;&#xFF0C;&#x5E76;&#x4E14; <code>EMFILE</code> &#x9519;&#x8BEF;&#x4F7F;&#x7528;&#x4E0E;&#x5176;&#x4ED6;&#x9519;&#x8BEF;&#x76F8;&#x540C;&#x7684;&#x91CD;&#x8BD5;&#x903B;&#x8F91;&#x3002; &#x652F;&#x6301; <code>retryDelay</code> &#x9009;&#x9879;&#x3002; <code>ENFILE</code> &#x9519;&#x8BEF;&#x4F1A;&#x88AB;&#x91CD;&#x8BD5;&#x3002;</p></td></tr>
  <tr><td>v12.10.0</td>
  <td><p>The <code>recursive</code>, <code>maxBusyTries</code>, and <code>emfileWait</code> options are now supported.</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <p></p><div class="api_stability api_stability_1"><a target="_blank" rel="nofollow" href="/api/documentation.html#documentation_stability_index">&#x7A33;&#x5B9A;&#x6027;: 1</a> - &#x9012;&#x5F52;&#x7684;&#x5220;&#x9664;&#x662F;&#x5B9E;&#x9A8C;&#x6027;&#x7684;&#x3002;</div><p></p>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>maxRetries</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x5982;&#x679C;&#x9047;&#x5230; <code>EBUSY</code>&#x3001; <code>EMFILE</code>&#x3001; <code>ENFILE</code>&#x3001; <code>ENOTEMPTY</code> &#x6216; <code>EPERM</code> &#x9519;&#x8BEF;&#xFF0C;&#x5219; Node.js &#x4F1A;&#x91CD;&#x8BD5;&#x8BE5;&#x64CD;&#x4F5C;&#xFF08;&#x6BCF;&#x6B21;&#x5C1D;&#x8BD5;&#x65F6;&#x4F7F;&#x7528; <code>retryDelay</code> &#x6BEB;&#x79D2;&#x65F6;&#x957F;&#x7684;&#x7EBF;&#x6027;&#x56DE;&#x9000;&#x7B49;&#x5F85;&#xFF09;&#x3002;
  &#x6B64;&#x9009;&#x9879;&#x8868;&#x793A;&#x91CD;&#x8BD5;&#x7684;&#x6B21;&#x6570;&#x3002;
  &#x5982;&#x679C; <code>recursive</code> &#x9009;&#x9879;&#x4E0D;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x6B64;&#x9009;&#x9879;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  <li><code>recursive</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x5982;&#x679C;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x6267;&#x884C;&#x9012;&#x5F52;&#x7684;&#x76EE;&#x5F55;&#x5220;&#x9664;&#x3002;
  &#x5728;&#x9012;&#x5F52;&#x6A21;&#x5F0F;&#x4E2D;&#xFF0C;&#x9519;&#x8BEF;&#x4E0D;&#x4F1A;&#x88AB;&#x62A5;&#x544A;&#xFF08;&#x5982;&#x679C; <code>path</code> &#x4E0D;&#x5B58;&#x5728;&#xFF09;&#xFF0C;&#x5E76;&#x4E14;&#x64CD;&#x4F5C;&#x4F1A;&#x88AB;&#x91CD;&#x8BD5;&#xFF08;&#x5F53;&#x5931;&#x8D25;&#x65F6;&#xFF09;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  <li><code>retryDelay</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> &#x91CD;&#x8BD5;&#x4E4B;&#x95F4;&#x7B49;&#x5F85;&#x7684;&#x65F6;&#x95F4;&#xFF08;&#x4EE5;&#x6BEB;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;&#xFF09;&#x3002;
  &#x5982;&#x679C; <code>recursive</code> &#x9009;&#x9879;&#x4E0D;&#x4E3A; <code>true</code>&#xFF0C;&#x5219;&#x6B64;&#x9009;&#x9879;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;
  <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>100</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5220;&#x9664; <code>path</code> &#x6307;&#x5B9A;&#x7684;&#x76EE;&#x5F55;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x5BF9;&#x6587;&#x4EF6;&#xFF08;&#x800C;&#x4E0D;&#x662F;&#x76EE;&#x5F55;&#xFF09;&#x4F7F;&#x7528; <code>fsPromises.rmdir()</code> &#x4F1A;&#x5BFC;&#x81F4; <code>Promise</code> &#x88AB;&#x62D2;&#x7EDD;&#xFF0C;&#x5728; Windows &#x4E0A;&#x4F1A;&#x5E26;&#x4E0A; <code>ENOENT</code> &#x9519;&#x8BEF;&#x3001;&#x5728; POSIX &#x4E0A;&#x4F1A;&#x5E26;&#x4E0A; <code>ENOTDIR</code> &#x9519;&#x8BEF;&#x3002;</p>
  <h3><code>fsPromises.stat(path[, options])</code><span><a class="mark" href="#fs_fspromises_stat_path_options" id="fs_fspromises_stat_path_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_stat_path_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_stat_path_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v10.5.0</td>
  <td><p>&#x63A5;&#x53D7;&#x989D;&#x5916;&#x7684; <code>options</code> &#x5BF9;&#x8C61;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x4E3A; bigint&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a></p>
  <ul>
  <li><code>bigint</code> <a href="/s/jFbvuT" target="_blank" rel="nofollow" class="type">&lt;boolean&gt;</a> &#x8FD4;&#x56DE;&#x7684; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x4E2D;&#x7684;&#x6570;&#x503C;&#x662F;&#x5426;&#x5E94;&#x4E3A; <code>bigint</code> &#x578B;&#x3002;<strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>false</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p><code>Promise</code> &#x4F1A;&#x88AB;&#x89E3;&#x51B3;&#x5E76;&#x5E26;&#x4E0A; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#xFF08;&#x7528;&#x4E8E;&#x7ED9;&#x5B9A;&#x7684; <code>path</code>&#xFF09;&#x3002;</p>
  <h3><code>fsPromises.symlink(target, path[, type])</code><span><a class="mark" href="#fs_fspromises_symlink_target_path_type" id="fs_fspromises_symlink_target_path_type">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_symlink_target_path_type.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_symlink_target_path_type.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>target</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>type</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;file&apos;</code>&#x3002;</li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <p><code>type</code> &#x53C2;&#x6570;&#x4EC5;&#x5728; Windows &#x4E0A;&#x53EF;&#x7528;&#xFF0C;&#x53EF;&#x4EE5;&#x662F; <code>&apos;dir&apos;</code>&#x3001; <code>&apos;file&apos;</code> &#x6216; <code>&apos;junction&apos;</code> &#x4E4B;&#x4E00;&#x3002;
  Windows &#x4E0A;&#x4F7F;&#x7528; <code>&apos;junction&apos;</code> &#x8981;&#x6C42;&#x76EE;&#x6807;&#x8DEF;&#x5F84;&#x662F;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x3002;
  &#x5F53;&#x4F7F;&#x7528; <code>&apos;junction&apos;</code> &#x65F6;&#xFF0C; <code>target</code> &#x53C2;&#x6570;&#x5C06;&#x81EA;&#x52A8;&#x6807;&#x51C6;&#x5316;&#x4E3A;&#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x3002;</p>
  <h3><code>fsPromises.truncate(path[, len])</code><span><a class="mark" href="#fs_fspromises_truncate_path_len" id="fs_fspromises_truncate_path_len">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_truncate_path_len.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_truncate_path_len.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>len</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0</code>&#x3002;</li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x622A;&#x65AD; <code>path</code>&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;
  <code>path</code> &#x5FC5;&#x987B;&#x662F;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x6216; <code>Buffer</code>&#x3002;</p>
  <h3><code>fsPromises.unlink(path)</code><span><a class="mark" href="#fs_fspromises_unlink_path" id="fs_fspromises_unlink_path">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_unlink_path.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_unlink_path.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x7684; <a href="/s/gjRRsM" rel="nofollow"><code>unlink(2)</code></a>&#x3002;
  <code>Promise</code> &#x5C06;&#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <h3><code>fsPromises.utimes(path, atime, mtime)</code><span><a class="mark" href="#fs_fspromises_utimes_path_atime_mtime" id="fs_fspromises_utimes_path_atime_mtime">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_utimes_path_atime_mtime.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_utimes_path_atime_mtime.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span>
  </div>
  <ul>
  <li><code>path</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a></li>
  <li><code>atime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li><code>mtime</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;number&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/A9TMoa" target="_blank" rel="nofollow" class="type">&lt;Date&gt;</a></li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x66F4;&#x6539; <code>path</code> &#x6307;&#x5411;&#x7684;&#x5BF9;&#x8C61;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x65F6;&#x95F4;&#x6233;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3; <code>Promise</code> &#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <p><code>atime</code> &#x548C; <code>mtime</code> &#x53C2;&#x6570;&#x9075;&#x5FAA;&#x4EE5;&#x4E0B;&#x89C4;&#x5219;&#xFF1A;</p>
  <ul>
  <li>&#x503C;&#x53EF;&#x4EE5;&#x662F;&#x8868;&#x793A; Unix &#x7EAA;&#x5143;&#x65F6;&#x95F4;&#x7684;&#x6570;&#x5B57;&#x3001; <code>Date</code> &#x5BF9;&#x8C61;&#x3001;&#x6216;&#x7C7B;&#x4F3C; <code>&apos;123456789.0&apos;</code> &#x7684;&#x6570;&#x503C;&#x5B57;&#x7B26;&#x4E32;&#x3002;</li>
  <li>&#x5982;&#x679C;&#x8BE5;&#x503C;&#x65E0;&#x6CD5;&#x8F6C;&#x6362;&#x4E3A;&#x6570;&#x503C;&#x3001;&#x6216;&#x503C;&#x4E3A; <code>NaN</code>&#x3001; <code>Infinity</code> &#x6216; <code>-Infinity</code>&#xFF0C;&#x5219;&#x629B;&#x51FA; <code>Error</code>&#x3002;</li>
  </ul>
  <h3><code>fsPromises.writeFile(file, data[, options])</code><span><a class="mark" href="#fs_fspromises_writefile_file_data_options" id="fs_fspromises_writefile_file_data_options">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/fspromises_writefile_file_data_options.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fspromises_writefile_file_data_options.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <div class="api_metadata">
  <details class="changelog"><summary>&#x7248;&#x672C;&#x5386;&#x53F2;</summary>
  <table>
  <tbody><tr><th>&#x7248;&#x672C;</th><th>&#x53D8;&#x66F4;</th></tr>
  <tr><td>v14.0.0</td>
  <td><p>&#x53C2;&#x6570; <code>data</code> &#x4E0D;&#x518D;&#x5F3A;&#x5236;&#x8F6C;&#x6362;&#x4E0D;&#x652F;&#x6301;&#x7684;&#x8F93;&#x5165;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p></td></tr>
  <tr><td>v10.0.0</td>
  <td><p><span>&#x65B0;&#x589E;&#x4E8E;: v10.0.0</span></p></td></tr>
  </tbody></table>
  </details>
  </div>
  <ul>
  <li><code>file</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/5dwq7G" target="_blank" rel="nofollow" class="type">&lt;URL&gt;</a> | <a href="/s/kLdifB" target="_blank" rel="nofollow" class="type">&lt;FileHandle&gt;</a> &#x6587;&#x4EF6;&#x540D;&#x6216; <code>FileHandle</code>&#x3002;</li>
  <li><code>data</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/6x1hD3" target="_blank" rel="nofollow" class="type">&lt;Buffer&gt;</a> | <a href="/s/ZbDkpm" target="_blank" rel="nofollow" class="type">&lt;Uint8Array&gt;</a></li>
  <li>
  <p><code>options</code> <a href="/s/jzn6Ao" target="_blank" rel="nofollow" class="type">&lt;Object&gt;</a> | <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a></p>
  <ul>
  <li><code>encoding</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> | <a href="/s/334hvC" target="_blank" rel="nofollow" class="type">&lt;null&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>&apos;utf8&apos;</code>&#x3002;</li>
  <li><code>mode</code> <a href="/s/SXbo1v" target="_blank" rel="nofollow" class="type">&lt;integer&gt;</a> <strong>&#x9ED8;&#x8BA4;&#x503C;:</strong> <code>0o666</code>&#x3002;</li>
  <li><code>flag</code> <a href="/s/9Tw2bK" target="_blank" rel="nofollow" class="type">&lt;string&gt;</a> &#x53C2;&#x89C1;<a href="/s/JjbY8n" rel="nofollow">&#x6587;&#x4EF6;&#x7CFB;&#x7EDF; <code>flag</code> &#x7684;&#x652F;&#x6301;</a>&#x3002;&#x9ED8;&#x8BA4;&#x503C;: <code>&apos;w&apos;</code>&#x3002;</li>
  </ul>
  </li>
  <li>&#x8FD4;&#x56DE;: <a href="/s/ri1kj8" target="_blank" rel="nofollow" class="type">&lt;Promise&gt;</a></li>
  </ul>
  <p>&#x5F02;&#x6B65;&#x5730;&#x5C06;&#x6570;&#x636E;&#x5199;&#x5165;&#x5230;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5DF2;&#x5B58;&#x5728;&#x5219;&#x8986;&#x76D6;&#x8BE5;&#x6587;&#x4EF6;&#x3002;
  <code>data</code> &#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x6216; buffer&#x3002;
  <code>Promise</code> &#x5C06;&#x4F1A;&#x5728;&#x6210;&#x529F;&#x65F6;&#x89E3;&#x51B3;&#xFF0C;&#x4E14;&#x4E0D;&#x5E26;&#x53C2;&#x6570;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>data</code> &#x662F; buffer&#xFF0C;&#x5219; <code>encoding</code> &#x9009;&#x9879;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;</p>
  <p>&#x5982;&#x679C; <code>options</code> &#x662F;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5219;&#x5B83;&#x6307;&#x5B9A;&#x5B57;&#x7B26;&#x7F16;&#x7801;&#x3002;</p>
  <p>&#x6307;&#x5B9A;&#x7684; <code>FileHandle</code> &#x5FC5;&#x987B;&#x652F;&#x6301;&#x5199;&#x5165;&#x3002;</p>
  <p>&#x5728;&#x540C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x4E0A;&#x591A;&#x6B21;&#x4F7F;&#x7528; <code>fsPromises.writeFile()</code> &#x4E14;&#x4E0D;&#x7B49;&#x5F85; <code>Promise</code> &#x88AB;&#x89E3;&#x51B3;&#xFF08;&#x6216;&#x88AB;&#x62D2;&#x7EDD;&#xFF09;&#x662F;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#x3002;</p>
  <h2>FS &#x5E38;&#x91CF;<span><a class="mark" href="#fs_fs_constants_1" id="fs_fs_constants_1">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/fs_constants_1.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/fs_constants_1.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x4EE5;&#x4E0B;&#x5E38;&#x91CF;&#x7531; <code>fs.constants</code> &#x8F93;&#x51FA;&#x3002;</p>
  <p>&#x5E76;&#x975E;&#x6240;&#x6709;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x90FD;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x6BCF;&#x4E2A;&#x5E38;&#x91CF;&#x3002;</p>
  <p>To use more than one constant, use the bitwise OR <code>|</code> operator.</p>
  <p>Example:</p>
  <pre><code class="language-js"><span class="hljs-keyword">const</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>);
  
  <span class="hljs-keyword">const</span> {
    O_RDWR,
    O_CREAT,
    O_EXCL
  } = fs.constants;
  
  fs.open(<span class="hljs-string">&apos;/path/to/my/file&apos;</span>, O_RDWR | O_CREAT | O_EXCL, (err, fd) =&gt; {
    <span class="hljs-comment">// ...</span>
  });</code></pre>
  <h3>&#x6587;&#x4EF6;&#x53EF;&#x8BBF;&#x95EE;&#x6027;&#x7684;&#x5E38;&#x91CF;<span><a class="mark" href="#fs_file_access_constants" id="fs_file_access_constants">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/file_access_constants.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_access_constants.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x4EE5;&#x4E0B;&#x5E38;&#x91CF;&#x9002;&#x7528;&#x4E8E; <a href="/s/NCPsM3" rel="nofollow"><code>fs.access()</code></a>&#x3002;</p>
  <table>
    <tbody><tr>
      <th>&#x5E38;&#x91CF;</th>
      <th>&#x8BF4;&#x660E;</th>
    </tr>
    <tr>
      <td><code>F_OK</code></td>
      <td>&#x8868;&#x660E;&#x6587;&#x4EF6;&#x5BF9;&#x8C03;&#x7528;&#x8FDB;&#x7A0B;&#x53EF;&#x89C1;&#x3002;
      &#x8FD9;&#x5BF9;&#x4E8E;&#x5224;&#x65AD;&#x6587;&#x4EF6;&#x662F;&#x5426;&#x5B58;&#x5728;&#x5F88;&#x6709;&#x7528;&#xFF0C;&#x4F46;&#x5BF9; <code>rwx</code> &#x6743;&#x9650;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x8BF4;&#x660E;&#x3002; 
      &#x5982;&#x679C;&#x672A;&#x6307;&#x5B9A;&#x6A21;&#x5F0F;&#xFF0C;&#x5219;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A;&#x8BE5;&#x503C;&#x3002;
      </td>
    </tr>
    <tr>
      <td><code>R_OK</code></td>
      <td>&#x8868;&#x660E;&#x8C03;&#x7528;&#x8FDB;&#x7A0B;&#x53EF;&#x4EE5;&#x8BFB;&#x53D6;&#x6587;&#x4EF6;&#x3002;</td>
    </tr>
    <tr>
      <td><code>W_OK</code></td>
      <td>&#x8868;&#x660E;&#x8C03;&#x7528;&#x8FDB;&#x7A0B;&#x53EF;&#x4EE5;&#x5199;&#x5165;&#x6587;&#x4EF6;&#x3002;</td>
    </tr>
    <tr>
      <td><code>X_OK</code></td>
      <td>&#x8868;&#x660E;&#x8C03;&#x7528;&#x8FDB;&#x7A0B;&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x6587;&#x4EF6;&#x3002;
      &#x5728; Windows &#x4E0A;&#x65E0;&#x6548;&#xFF08;&#x8868;&#x73B0;&#x5F97;&#x50CF; <code>fs.constants.F_OK</code>&#xFF09;&#x3002;
      </td>
    </tr>
  </tbody></table>
  <h3>&#x6587;&#x4EF6;&#x62F7;&#x8D1D;&#x7684;&#x5E38;&#x91CF;<span><a class="mark" href="#fs_file_copy_constants" id="fs_file_copy_constants">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/file_copy_constants.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_copy_constants.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x4EE5;&#x4E0B;&#x5E38;&#x91CF;&#x9002;&#x7528;&#x4E8E; <a href="/s/ASzQrc" rel="nofollow"><code>fs.copyFile()</code></a>&#x3002;</p>
  <table>
    <tbody><tr>
      <th>&#x5E38;&#x91CF;</th>
      <th>&#x8BF4;&#x660E;</th>
    </tr>
    <tr>
      <td><code>COPYFILE_EXCL</code></td>
      <td>&#x5982;&#x679C;&#x76EE;&#x6807;&#x8DEF;&#x5F84;&#x5DF2;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;</td>
    </tr>
    <tr>
      <td><code>COPYFILE_FICLONE</code></td>
      <td>&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5C1D;&#x8BD5;&#x521B;&#x5EFA;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#x94FE;&#x63A5;&#x3002;
      &#x5982;&#x679C;&#x5E95;&#x5C42;&#x5E73;&#x53F0;&#x4E0D;&#x652F;&#x6301;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF0C;&#x5219;&#x4F7F;&#x7528;&#x5907;&#x9009;&#x7684;&#x62F7;&#x8D1D;&#x673A;&#x5236;&#x3002;
      </td>
    </tr>
    <tr>
      <td><code>COPYFILE_FICLONE_FORCE</code></td>
      <td>&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5C1D;&#x8BD5;&#x521B;&#x5EFA;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#x94FE;&#x63A5;&#x3002;
      &#x5982;&#x679C;&#x5E95;&#x5C42;&#x5E73;&#x53F0;&#x4E0D;&#x652F;&#x6301;&#x5199;&#x65F6;&#x62F7;&#x8D1D;&#xFF0C;&#x5219;&#x62F7;&#x8D1D;&#x64CD;&#x4F5C;&#x5C06;&#x5931;&#x8D25;&#x3002;
      </td>
    </tr>
  </tbody></table>
  <h3>&#x6587;&#x4EF6;&#x6253;&#x5F00;&#x7684;&#x5E38;&#x91CF;<span><a class="mark" href="#fs_file_open_constants" id="fs_file_open_constants">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/file_open_constants.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_open_constants.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x4EE5;&#x4E0B;&#x5E38;&#x91CF;&#x9002;&#x7528;&#x4E8E; <code>fs.open()</code>&#x3002;</p>
  <table>
    <tbody><tr>
      <th>&#x5E38;&#x91CF;</th>
      <th>&#x8BF4;&#x660E;</th>
    </tr>
    <tr>
      <td><code>O_RDONLY</code></td>
      <td>&#x8868;&#x660E;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x53EA;&#x8BFB;&#x8BBF;&#x95EE;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_WRONLY</code></td>
      <td>&#x8868;&#x660E;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x53EA;&#x5199;&#x8BBF;&#x95EE;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_RDWR</code></td>
      <td>&#x8868;&#x660E;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x8BFB;&#x5199;&#x8BBF;&#x95EE;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_CREAT</code></td>
      <td>&#x8868;&#x660E;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5C1A;&#x4E0D;&#x5B58;&#x5728;&#x5219;&#x521B;&#x5EFA;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_EXCL</code></td>
      <td>&#x8868;&#x660E;&#x5982;&#x679C;&#x8BBE;&#x7F6E;&#x4E86; <code>O_CREAT</code> &#x6807;&#x5FD7;&#x4E14;&#x6587;&#x4EF6;&#x5DF2;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x5E94;&#x8BE5;&#x5931;&#x8D25;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_NOCTTY</code></td>
      <td>&#x8868;&#x660E;&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x8868;&#x793A;&#x7EC8;&#x7AEF;&#x8BBE;&#x5907;&#xFF0C;&#x5219;&#x6253;&#x5F00;&#x8BE5;&#x8DEF;&#x5F84;&#x4E0D;&#x5E94;&#x8BE5;&#x9020;&#x6210;&#x8BE5;&#x7EC8;&#x7AEF;&#x53D8;&#x6210;&#x8FDB;&#x7A0B;&#x7684;&#x63A7;&#x5236;&#x7EC8;&#x7AEF;&#xFF08;&#x5982;&#x679C;&#x8FDB;&#x7A0B;&#x8FD8;&#x6CA1;&#x6709;&#x7EC8;&#x7AEF;&#xFF09;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_TRUNC</code></td>
      <td>&#x8868;&#x660E;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5B58;&#x5728;&#x4E14;&#x662F;&#x666E;&#x901A;&#x7684;&#x6587;&#x4EF6;&#x3001;&#x5E76;&#x4E14;&#x6587;&#x4EF6;&#x6210;&#x529F;&#x6253;&#x5F00;&#x4EE5;&#x8FDB;&#x884C;&#x5199;&#x5165;&#x8BBF;&#x95EE;&#xFF0C;&#x5219;&#x5176;&#x957F;&#x5EA6;&#x5E94;&#x622A;&#x65AD;&#x4E3A;&#x96F6;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_APPEND</code></td>
      <td>&#x8868;&#x660E;&#x6570;&#x636E;&#x5C06;&#x4F1A;&#x8FFD;&#x52A0;&#x5230;&#x6587;&#x4EF6;&#x7684;&#x672B;&#x5C3E;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_DIRECTORY</code></td>
      <td>&#x8868;&#x660E;&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x4E0D;&#x662F;&#x76EE;&#x5F55;&#xFF0C;&#x5219;&#x6253;&#x5F00;&#x5E94;&#x8BE5;&#x5931;&#x8D25;&#x3002;</td>
    </tr>
    <tr>
    <td><code>O_NOATIME</code></td>
      <td>&#x8868;&#x660E;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x7684;&#x8BFB;&#x53D6;&#x8BBF;&#x95EE;&#x5C06;&#x4E0D;&#x518D;&#x5BFC;&#x81F4;&#x4E0E;&#x6587;&#x4EF6;&#x76F8;&#x5173;&#x8054;&#x7684; <code>atime</code> &#x4FE1;&#x606F;&#x7684;&#x66F4;&#x65B0;&#x3002;
      &#x4EC5;&#x5728; Linux &#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x4E0A;&#x53EF;&#x7528;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_NOFOLLOW</code></td>
      <td>&#x8868;&#x660E;&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x662F;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#xFF0C;&#x5219;&#x6253;&#x5F00;&#x5E94;&#x8BE5;&#x5931;&#x8D25;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_SYNC</code></td>
      <td>&#x8868;&#x660E;&#x6587;&#x4EF6;&#x662F;&#x4E3A;&#x540C;&#x6B65; I/O &#x6253;&#x5F00;&#x7684;&#xFF0C;&#x5199;&#x5165;&#x64CD;&#x4F5C;&#x5C06;&#x4F1A;&#x7B49;&#x5F85;&#x6587;&#x4EF6;&#x7684;&#x5B8C;&#x6574;&#x6027;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_DSYNC</code></td>
      <td>&#x8868;&#x660E;&#x6587;&#x4EF6;&#x662F;&#x4E3A;&#x540C;&#x6B65; I/O &#x6253;&#x5F00;&#x7684;&#xFF0C;&#x5199;&#x5165;&#x64CD;&#x4F5C;&#x5C06;&#x4F1A;&#x7B49;&#x5F85;&#x6570;&#x636E;&#x7684;&#x5B8C;&#x6574;&#x6027;</td>
    </tr>
    <tr>
      <td><code>O_SYMLINK</code></td>
      <td>&#x8868;&#x660E;&#x6253;&#x5F00;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#x81EA;&#x8EAB;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x5B83;&#x6307;&#x5411;&#x7684;&#x8D44;&#x6E90;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_DIRECT</code></td>
      <td>&#x8868;&#x660E;&#x5C06;&#x5C1D;&#x8BD5;&#x6700;&#x5C0F;&#x5316;&#x6587;&#x4EF6; I/O &#x7684;&#x7F13;&#x5B58;&#x6548;&#x679C;&#x3002;</td>
    </tr>
    <tr>
      <td><code>O_NONBLOCK</code></td>
      <td>&#x8868;&#x660E;&#x5728;&#x53EF;&#x80FD;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x4EE5;&#x975E;&#x963B;&#x585E;&#x6A21;&#x5F0F;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x3002;</td>
    </tr>
    <tr>
      <td><code>UV_FS_O_FILEMAP</code></td>
      <td>&#x5F53;&#x8BBE;&#x7F6E;&#x540E;&#xFF0C;&#x5C06;&#x4F1A;&#x4F7F;&#x7528;&#x5185;&#x5B58;&#x6587;&#x4EF6;&#x7684;&#x6620;&#x5C04;&#x6765;&#x8BBF;&#x95EE;&#x6587;&#x4EF6;&#x3002; 
      &#x6B64;&#x6807;&#x5FD7;&#x4EC5;&#x5728; Windows &#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x4E0A;&#x53EF;&#x7528;&#x3002; 
      &#x5728;&#x5176;&#x4ED6;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x6B64;&#x6807;&#x5FD7;&#x4F1A;&#x88AB;&#x5FFD;&#x7565;&#x3002;</td>
    </tr>
  </tbody></table>
  <h3>&#x6587;&#x4EF6;&#x7C7B;&#x578B;&#x7684;&#x5E38;&#x91CF;<span><a class="mark" href="#fs_file_type_constants" id="fs_file_type_constants">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/file_type_constants.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_type_constants.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x4EE5;&#x4E0B;&#x5E38;&#x91CF;&#x9002;&#x7528;&#x4E8E; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x7684; <code>mode</code> &#x5C5E;&#x6027;&#xFF0C;&#x7528;&#x4E8E;&#x51B3;&#x5B9A;&#x6587;&#x4EF6;&#x7684;&#x7C7B;&#x578B;&#x3002;</p>
  <table>
    <tbody><tr>
      <th>&#x5E38;&#x91CF;</th>
      <th>&#x8BF4;&#x660E;</th>
    </tr>
    <tr>
      <td><code>S_IFMT</code></td>
      <td>&#x7528;&#x4E8E;&#x63D0;&#x53D6;&#x6587;&#x4EF6;&#x7C7B;&#x578B;&#x4EE3;&#x7801;&#x7684;&#x4F4D;&#x63A9;&#x7801;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IFREG</code></td>
      <td>&#x8868;&#x793A;&#x666E;&#x901A;&#x7684;&#x6587;&#x4EF6;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IFDIR</code></td>
      <td>&#x8868;&#x793A;&#x76EE;&#x5F55;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IFCHR</code></td>
      <td>&#x8868;&#x793A;&#x9762;&#x5411;&#x5B57;&#x7B26;&#x7684;&#x8BBE;&#x5907;&#x6587;&#x4EF6;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IFBLK</code></td>
      <td>&#x8868;&#x793A;&#x9762;&#x5411;&#x5757;&#x7684;&#x8BBE;&#x5907;&#x6587;&#x4EF6;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IFIFO</code></td>
      <td>&#x8868;&#x793A; FIFO &#x6216;&#x7BA1;&#x9053;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IFLNK</code></td>
      <td>&#x8868;&#x793A;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IFSOCK</code></td>
      <td>&#x8868;&#x793A;&#x5957;&#x63A5;&#x5B57;&#x3002;</td>
    </tr>
  </tbody></table>
  <h3>&#x6587;&#x4EF6;&#x6A21;&#x5F0F;&#x7684;&#x5E38;&#x91CF;<span><a class="mark" href="#fs_file_mode_constants" id="fs_file_mode_constants">#</a></span></h3><p class="tip_wrap"><a href="/api/fs/file_mode_constants.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_mode_constants.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x4EE5;&#x4E0B;&#x5E38;&#x91CF;&#x9002;&#x7528;&#x4E8E; <a href="/s/NMuvVx" rel="nofollow"><code>fs.Stats</code></a> &#x5BF9;&#x8C61;&#x7684; <code>mode</code> &#x5C5E;&#x6027;&#xFF0C;&#x7528;&#x4E8E;&#x51B3;&#x5B9A;&#x6587;&#x4EF6;&#x7684;&#x8BBF;&#x95EE;&#x6743;&#x9650;&#x3002;</p>
  <table>
    <tbody><tr>
      <th>&#x5E38;&#x91CF;</th>
      <th>&#x8BF4;&#x660E;</th>
    </tr>
    <tr>
      <td><code>S_IRWXU</code></td>
      <td>&#x8868;&#x660E;&#x6240;&#x6709;&#x8005;&#x53EF;&#x8BFB;&#x3001;&#x53EF;&#x5199;&#x3001;&#x53EF;&#x6267;&#x884C;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IRUSR</code></td>
      <td>&#x8868;&#x660E;&#x6240;&#x6709;&#x8005;&#x53EF;&#x8BFB;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IWUSR</code></td>
      <td>&#x8868;&#x660E;&#x6240;&#x6709;&#x8005;&#x53EF;&#x5199;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IXUSR</code></td>
      <td>&#x8868;&#x660E;&#x6240;&#x6709;&#x8005;&#x53EF;&#x6267;&#x884C;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IRWXG</code></td>
      <td>&#x8868;&#x660E;&#x7FA4;&#x7EC4;&#x53EF;&#x8BFB;&#x3001;&#x53EF;&#x5199;&#x3001;&#x53EF;&#x6267;&#x884C;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IRGRP</code></td>
      <td>&#x8868;&#x660E;&#x7FA4;&#x7EC4;&#x53EF;&#x8BFB;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IWGRP</code></td>
      <td>&#x8868;&#x660E;&#x7FA4;&#x7EC4;&#x53EF;&#x5199;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IXGRP</code></td>
      <td>&#x8868;&#x660E;&#x7FA4;&#x7EC4;&#x53EF;&#x6267;&#x884C;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IRWXO</code></td>
      <td>&#x8868;&#x660E;&#x5176;&#x4ED6;&#x4EBA;&#x53EF;&#x8BFB;&#x3001;&#x53EF;&#x5199;&#x3001;&#x53EF;&#x6267;&#x884C;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IROTH</code></td>
      <td>&#x8868;&#x660E;&#x5176;&#x4ED6;&#x4EBA;&#x53EF;&#x8BFB;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IWOTH</code></td>
      <td>&#x8868;&#x660E;&#x5176;&#x4ED6;&#x4EBA;&#x53EF;&#x5199;&#x3002;</td>
    </tr>
    <tr>
      <td><code>S_IXOTH</code></td>
      <td>&#x8868;&#x660E;&#x5176;&#x4ED6;&#x4EBA;&#x53EF;&#x6267;&#x884C;&#x3002;</td>
    </tr>
  </tbody></table>
  <h2>&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x6807;&#x5FD7;<span><a class="mark" href="#fs_file_system_flags" id="fs_file_system_flags">#</a></span></h2><p class="tip_wrap"><a href="/api/fs/file_system_flags.html" class="tip_trans">&#x4E2D;&#x82F1;&#x5BF9;&#x7167;</a><a rel="nofollow" target="_blank" href="https://github.com/nodejscn/node-api-cn/edit/master/fs/file_system_flags.md" class="tip_en">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a></p>
  <p>&#x5F53; <code>flag</code> &#x9009;&#x9879;&#x91C7;&#x7528;&#x5B57;&#x7B26;&#x4E32;&#x65F6;&#xFF0C;&#x5219;&#x4EE5;&#x4E0B;&#x6807;&#x5FD7;&#x5747;&#x53EF;&#x7528;&#xFF1A;</p>
  <ul>
  <li>
  <p><code>&apos;a&apos;</code>: &#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x8FFD;&#x52A0;&#x3002;
  &#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x521B;&#x5EFA;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;ax&apos;</code>: &#x7C7B;&#x4F3C;&#x4E8E; <code>&apos;a&apos;</code>&#xFF0C;&#x4F46;&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x5931;&#x8D25;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;a+&apos;</code>: &#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x8BFB;&#x53D6;&#x548C;&#x8FFD;&#x52A0;&#x3002;
  &#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x521B;&#x5EFA;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;ax+&apos;</code>: &#x7C7B;&#x4F3C;&#x4E8E; <code>&apos;a+&apos;</code>&#xFF0C;&#x4F46;&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x5931;&#x8D25;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;as&apos;</code>: &#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x8FFD;&#x52A0;&#xFF08;&#x5728;&#x540C;&#x6B65;&#x6A21;&#x5F0F;&#x4E2D;&#xFF09;&#x3002;
  &#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x521B;&#x5EFA;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;as+&apos;</code>: &#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x8BFB;&#x53D6;&#x548C;&#x8FFD;&#x52A0;&#xFF08;&#x5728;&#x540C;&#x6B65;&#x6A21;&#x5F0F;&#x4E2D;&#xFF09;&#x3002;
  &#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x521B;&#x5EFA;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;r&apos;</code>: &#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x8BFB;&#x53D6;&#x3002;
  &#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x4F1A;&#x53D1;&#x751F;&#x5F02;&#x5E38;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;r+&apos;</code>: &#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x8BFB;&#x53D6;&#x548C;&#x5199;&#x5165;&#x3002;
  &#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x4F1A;&#x53D1;&#x751F;&#x5F02;&#x5E38;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;rs+&apos;</code>: &#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x8BFB;&#x53D6;&#x548C;&#x5199;&#x5165;&#xFF08;&#x5728;&#x540C;&#x6B65;&#x6A21;&#x5F0F;&#x4E2D;&#xFF09;&#x3002;
  &#x6307;&#x793A;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x7ED5;&#x8FC7;&#x672C;&#x5730;&#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x7F13;&#x5B58;&#x3002;</p>
  <p>&#x8FD9;&#x5BF9;&#x4E8E;&#x5728; NFS &#x6302;&#x8F7D;&#x4E0A;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x65F6;&#x975E;&#x5E38;&#x6709;&#x7528;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x53EF;&#x4EE5;&#x8DF3;&#x8FC7;&#x53EF;&#x80FD;&#x8FC7;&#x65F6;&#x7684;&#x672C;&#x5730;&#x7F13;&#x5B58;&#x3002;
  &#x5B83;&#x5BF9; I/O &#x6027;&#x80FD;&#x6709;&#x975E;&#x5E38;&#x5B9E;&#x9645;&#x7684;&#x5F71;&#x54CD;&#xFF0C;&#x56E0;&#x6B64;&#x4E0D;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528;&#x6B64;&#x6807;&#x5FD7;&#xFF08;&#x9664;&#x975E;&#x771F;&#x7684;&#x9700;&#x8981;&#xFF09;&#x3002;</p>
  <p>&#x8FD9;&#x4E0D;&#x4F1A;&#x628A; <code>fs.open()</code> &#x6216; <code>fsPromises.open()</code> &#x53D8;&#x6210;&#x540C;&#x6B65;&#x7684;&#x963B;&#x585E;&#x8C03;&#x7528;&#x3002;
  &#x5982;&#x679C;&#x9700;&#x8981;&#x540C;&#x6B65;&#x7684;&#x64CD;&#x4F5C;&#xFF0C;&#x5219;&#x5E94;&#x4F7F;&#x7528; <code>fs.openSync()</code> &#x4E4B;&#x7C7B;&#x7684;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;w&apos;</code>: &#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x5199;&#x5165;&#x3002;
  &#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&#x5219;&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5B58;&#x5728;&#x5219;&#x622A;&#x65AD;&#x6587;&#x4EF6;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;wx&apos;</code>: &#x7C7B;&#x4F3C;&#x4E8E; <code>&apos;w&apos;</code>&#xFF0C;&#x4F46;&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x5931;&#x8D25;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;w+&apos;</code>: &#x6253;&#x5F00;&#x6587;&#x4EF6;&#x7528;&#x4E8E;&#x8BFB;&#x53D6;&#x548C;&#x5199;&#x5165;&#x3002;
  &#x5982;&#x679C;&#x6587;&#x4EF6;&#x4E0D;&#x5B58;&#x5728;&#x5219;&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#xFF0C;&#x5982;&#x679C;&#x6587;&#x4EF6;&#x5B58;&#x5728;&#x5219;&#x622A;&#x65AD;&#x6587;&#x4EF6;&#x3002;</p>
  </li>
  <li>
  <p><code>&apos;wx+&apos;</code>: &#x7C7B;&#x4F3C;&#x4E8E; <code>&apos;w+&apos;</code>&#xFF0C;&#x4F46;&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x5931;&#x8D25;&#x3002;</p>
  </li>
  </ul>
  <p><code>flag</code> &#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x6570;&#x5B57;&#xFF0C;&#x53C2;&#x89C1; <a href="/s/ss2dGs" rel="nofollow"><code>open(2)</code></a> &#x6587;&#x6863;&#x3002;
  &#x5E38;&#x7528;&#x7684;&#x5E38;&#x91CF;&#x53EF;&#x4EE5;&#x4ECE; <code>fs.constants</code> &#x83B7;&#x53D6;&#x3002;
  &#x5728; Windows &#x4E0A;&#xFF0C;&#x6807;&#x5FD7;&#x4F1A;&#x88AB;&#x8F6C;&#x6362;&#x4E3A;&#x5408;&#x9002;&#x7684;&#x7B49;&#x6548;&#x6807;&#x5FD7;&#xFF0C;&#x4F8B;&#x5982; <code>O_WRONLY</code> &#x8F6C;&#x6362;&#x4E3A; <code>FILE_GENERIC_WRITE</code>&#x3001; <code>O_EXCL|O_CREAT</code> &#x8F6C;&#x6362;&#x4E3A;&#x80FD;&#x88AB; <code>CreateFileW</code> &#x63A5;&#x53D7;&#x7684; <code>CREATE_NEW</code>&#x3002;</p>
  <p>&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x6392;&#x4ED6;&#x6027;&#x6807;&#x5FD7; <code>&apos;x&apos;</code>&#xFF08; <a href="/s/ss2dGs" rel="nofollow"><code>open(2)</code></a> &#x4E2D;&#x7684; <code>O_EXCL</code> &#x6807;&#x5FD7;&#xFF09;&#x4F1A;&#x4F7F;&#x64CD;&#x4F5C;&#x8FD4;&#x56DE;&#x9519;&#x8BEF;&#x3002;
  &#x5728; POSIX &#x4E0A;&#xFF0C;&#x5982;&#x679C;&#x8DEF;&#x5F84;&#x662F;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#xFF0C;&#x5219;&#x4F7F;&#x7528; <code>O_EXCL</code> &#x4E5F;&#x4F1A;&#x8FD4;&#x56DE;&#x9519;&#x8BEF;&#xFF08;&#x5373;&#x4F7F;&#x7B26;&#x53F7;&#x94FE;&#x63A5;&#x6307;&#x5411;&#x4E0D;&#x5B58;&#x5728;&#x7684;&#x8DEF;&#x5F84;&#xFF09;&#x3002;
  &#x6392;&#x4ED6;&#x6027;&#x6807;&#x5FD7;&#x4E0D;&#x4E00;&#x5B9A;&#x9002;&#x7528;&#x4E8E;&#x7F51;&#x7EDC;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x3002;</p>
  <p>&#x5728; Linux &#x4E0A;&#xFF0C;&#x5F53;&#x4EE5;&#x8FFD;&#x52A0;&#x6A21;&#x5F0F;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x65F6;&#xFF0C;&#x5219;&#x5199;&#x5165;&#x65F6;&#x65E0;&#x6CD5;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x3002;
  &#x5185;&#x6838;&#x4F1A;&#x5FFD;&#x7565;&#x4F4D;&#x7F6E;&#x53C2;&#x6570;&#xFF0C;&#x5E#x5E76;&#x59CB;&#x7EC8;&#x8FFD;&#x52A0;&#x6570;&#x636E;&#x5230;&#x6587;&#x4EF6;&#x7684;&#x672B;&#x5C3E;&#x3002;</p>
  <p>&#x5982;&#x679C;&#x8981;&#x4FEE;&#x6539;&#x6587;&#x4EF6;&#x800C;&#x4E0D;&#x662F;&#x8986;&#x76D6;&#x6587;&#x4EF6;&#xFF0C;&#x5219; <code>flag</code> &#x9009;&#x9879;&#x9700;&#x8981;&#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; <code>&apos;r+&apos;</code> &#x800C;&#x4E0D;&#x662F;&#x9ED8;&#x8BA4;&#x7684; <code>&apos;w&apos;</code>&#x3002;</p>
  <p>&#x6709;&#x4E9B;&#x6807;&#x5FD7;&#x7684;&#x884C;&#x4E3A;&#x662F;&#x7279;&#x5B9A;&#x4E8E;&#x5E73;&#x53F0;&#x7684;&#x3002;
  &#x4F8B;&#x5982;&#xFF0C;&#x5728; macOS &#x548C; Linux &#x4E0A;&#x4F7F;&#x7528; <code>&apos;a+&apos;</code> &#x6807;&#x5FD7;&#x6253;&#x5F00;&#x76EE;&#x5F55;&#x4F1A;&#x8FD4;&#x56DE;&#x9519;&#x8BEF;&#x3002;
  &#x4F46;&#x662F;&#xFF0C;&#x5728; Windows &#x548C; FreeBSD &#x4E0A;&#xFF0C;&#x5219;&#x4F1A;&#x8FD4;&#x56DE;&#x6587;&#x4EF6;&#x63CF;&#x8FF0;&#x7B26;&#x6216; <code>FileHandle</code>&#x3002;</p>
  <pre><code class="language-js"><span class="hljs-comment">// &#x5728; macOS &#x548C; Linux &#x4E0A;&#xFF1A;</span>
  fs.open(<span class="hljs-string">&apos;&lt;&#x76EE;&#x5F55;&gt;&apos;</span>, <span class="hljs-string">&apos;a+&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-comment">// =&gt; [Error: EISDIR: illegal operation on a directory, open &lt;&#x76EE;&#x5F55;&gt;]</span>
  });
  
  <span class="hljs-comment">// &#x5728; Windows &#x548C; FreeBSD &#x4E0A;&#xFF1A;</span>
  fs.open(<span class="hljs-string">&apos;&lt;&#x76EE;&#x5F55;&gt;&apos;</span>, <span class="hljs-string">&apos;a+&apos;</span>, (err, fd) =&gt; {
    <span class="hljs-comment">// =&gt; null, &lt;fd&gt;</span>
  });</code></pre>
  <p>&#x5728; Windows &#x4E0A;&#xFF0C;&#x4F7F;&#x7528; <code>&apos;w&apos;</code> &#x6807;&#x5FD7;&#x6253;&#x5F00;&#xFF08;&#x901A;&#x8FC7; <code>fs.open()</code>&#x3001; <code>fs.writeFile()</code> &#x6216; <code>fsPromises.open()</code>&#xFF09;&#x73B0;&#x6709;&#x7684;&#x9690;&#x85CF;&#x6587;&#x4EF6;&#xFF0C;&#x5219;&#x4F1A;&#x629B;&#x51FA; <code>EPERM</code>&#x3002;
  &#x73B0;&#x6709;&#x7684;&#x9690;&#x85CF;&#x6587;&#x4EF6;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>&apos;r+&apos;</code> &#x6807;&#x5FD7;&#x6253;&#x5F00;&#x7528;&#x4E8E;&#x5199;&#x5165;&#x3002;</p>
  <p>&#x8C03;&#x7528; <code>fs.ftruncate()</code> &#x6216; <code>fsPromises.ftruncate()</code> &#x53EF;&#x4EE5;&#x7528;&#x4E8E;&#x91CD;&#x7F6E;&#x6587;&#x4EF6;&#x7684;&#x5185;&#x5BB9;&#x3002;</p>
            <!-- API END -->
          </div>
        </div>
      </div>
    </div>
    <!-- 搜索弹窗 -->
    <!-- <div id="search_modal"></div> -->
    <!-- js -->
    <!--[if lt IE 10]><script src="/static/lib/placeholders.js?20170426"></script><![endif]-->
    
    <script>
      document.write('<script src="' + (location.port ? '' : '//static.nodejs.cn') + '/_static/js/api.js?1597399169734"><\/script>');
    </script>
  
  </body></html>
  